What is PHP exactly?
It’s a programming language. It’s an interpreted language, which means that PHP code isn’t compiled into a binary executable, but rather is interpreted at run-time. This sort of language is also called a “scripting language,” and some people refer to programs written in these types of languages as “scripts” rather than “programs.”
It is still focused on the web, but is capable of doing a lot more than passing content variables into an HTML template. It is a full-scale language and can accomplish just about anything that any other language can do.
Why is PHP so popular?
Many people consider PHP very easy to read and write. For example, Mark Zuckerberg has said that one of the reasons Facebook uses PHP is that it is easy to get stuff done in PHP — it is “good for hacking on.”
On the other hand, proponents of other languages say similar things. A more likely explanation of its widespread use is WordPress.
WordPress is a Blogging and Content Management System. It powers over 23% of the websites on the internet. A lot of PHP developers got their start using WordPress, and its easy to go from tweaking WordPress themes to writing plugins, to building entire web applications.
The barrier to entry for PHP is fairly low, so a lot of people learn it. A lot of people learn it, so then a lot of project get started using it.
PHP grows up
Early versions of PHP weren’t a complete language, and didn’t support all the types of things you might normally want to do if you were building a web application. And there were performance issues.
That’s what happens when you try to solve a specific problem. It takes a while to turn a specific solution into a generalized toolset, and even longer to turn it into a complete toolset.
But eventually it happened.
In 2004, PHP 5 was released. With PHP 5, many people believe that the language was now really, truly, a programming language in the full sense of the term.
The biggest change in PHP 5 was support for Object-Oriented Programming.
PHP 5 and Object Oriented Programming
Object Oriented Programming (OOP) is a way of conceptualizing and writing a program, in which data objects contain both attributes and methods for interacting with those attributes, as well as with other objects.
An example of this in web development is a blog post. The attributes of a blog post might be its title, its author, it content, and so forth. Methods might include saving it to the database, editing its content, and displaying it on the page.
Even though OOP was invented in the 1960s, it didn’t become mainstream for most programmers and programming languages until the mid-1990s. When PHP was invented, OOP was still a pretty new idea.
Ten years later, after four major version releases of PHP, Object Oriented Programming had become “the right way” to write software, and the minimal support for OOP concepts in PHP 4 just wasn’t enough.
PHP 5 provided complete support for Object Orientation, along with a number of other improvements that really changed the way people write PHP programs, and allowed it to compete with other languages that had started to dominate ‘serious’ web development.
Closely related features
PHP 5 Frequently Asked Questions
Is PHP 5 just for making websites?
No. PHP 5 can be used to build websites, command line scripting, or desktop GUI applications. The command line scripting can be used for tasks such as auto-generating offline images or processing text files. Unlike web-based PHP 5 applications, this does not require a browser or server. You simply need access to the command line executable. PHP 5 can be used to build desktop GUI applications similar to any other modern programming language; however, to do so you must first install the PHP-GTK extension.
Since PHP 5 is a programming language, do I need any specific software to use it?
Yes. Most web hosts include support for PHP 5, but you can also download the latest version from the PHP website. If you’re using PHP 5 to develop websites, you will need access to a modern browser and a website. If you are using PHP 5 to develop commend line applications or desktop applications, you won’t need a browser or a server, but you may need additional extensions.
Is PHP 5 compatible with PHP 4?
Yes. PHP 5 added several new features, but remains compatible with earlier versions. However, it is recommended that you review the documentation on PHP 5 migration available on the PHP website, as some functions may be lost when migrating from earlier versions.
How can I report an issue with PHP 5?
If you identify an issue, you should review the bug database on the PHP website, to make sure it is not already known. If the bug is not already on the database, you should use the reporting form available with the bug database.
Like most open source programs, support for PHP 5 is provided through a vast community network. There are a number of frequently asked questions answered on their website, along with a large documentation library. Several mailing lists are available to discuss PHP-related projects. There is an official PHP newsgroup, several user groups, and a number of local events available for programmers looking to become more active in the PHP community.
PHP 5 can be used on all major operating systems, including Windows, Linux/Unix, and Mac OS. Precompiled binary versions of the installation software are available for Windows; however, for other operating systems, you will need to download the source code and compile it specifically for your system.
What databases does PHP 5 support?
PHP 5 was built to support a wide variety of databases, including SQLite, MySQL, MS-SQL, PostgreSQL, FrontBase, Mongo, Paradox, filePro, and more many more. It includes support for dBA, dbx, Open Database Connection standard, and PHP Data Objects.
If I’m designing a website, do I need to choose either HTML or PHP?
No. PHP is an embedded script, meaning you can add it into an HTML script, provided your server supports PHP. A web-based PHP script is essentially and HTML page with bits of PHP inserted wherever dynamic content is required. You can also embed HTML code into PHP script.
What functionality does PHP add to HTML?
PHP provides dynamic functionality for your webpage. It can perform calculations such as determining the date or handling mathematical equations. It can collect user input, such as obtaining an imperial measurement to convert it to metric, adding information to an address book, or letting users post to a forum or social media site. PHP can interact with most common databases, and it can be used to create graphics.
Are there alternatives available that provide the same functionality as PHP?
While you won’t get the exact same functionality from any one program, many of the features PHP adds to web development can be obtained through other sources. PHP was built on other programming languages, including C, so C can be used in place of PHP. Perl was one of the most popular languages for web development prior to PHP. While its syntax is considerably more complex than PHP, it continues to be popular with some developers due to its string manipulation capabilities. The Seaside framework provides the same dynamic functionality with object oriented web development.
About Adam Michael Wood
Adam specializes in developer documentation and tutorials. In addition to his writing here, he has authored engineering guides and other long-form technical manuals. Outside of work, Adam composes and performs liturgical music. He lives with his wife and children in California.