Why PHP?

Submitted by peter on Mon, 06/04/2018 - 12:58

PHP is the most popular language for Web development. A common question is "Why PHP?". This page is an update for 2018.

Back at the start of PHP, the first version handled forms better than anything else on the Web. PHP version 3 handled everything you needed for the Web, was really easy to use, and the only argument against PHP was the processing speed for some code.

PHP 4 was faster than PHP 3. PHP 5 was faster than PHP 4. PHP 7 is faster than PHP 5, uses far less memory, and is close to machine speed, the maximum speed you can get from a computer.

Execution speed

Lets focus on execution speed for a few seconds. Machine speed is the maximum speed you can get from a computer. You have to write your programs using assembler, a very slow and tedious process. You then have to use a different assembler language for every type of processor.

The C programming language is a poor substitute for assembler but C code can be compiled on most computers. PHP 7 runs at a speed close to C. The small difference between PHP and C is less than the hardware performance improvement you get every six months.

Development speed

Which brings us to development speed.

Most Web development uses frameworks or a similar set of reusable code. You create code using building blocks and code specific to your application or business. Frameworks and libraries of code can be slow to execute. What they do is save development time.

If you start from no code, your Web site might require two years of development in PHP or ten years of development in C. Using libraries of prewritten code might cut the development time in half. A framework might cut development time to a quarter or less, compared to writing the code yourself.

Due to PHP's popularity, there are many PHP frameworks for Web development. C has libraries but no frameworks for Web development. If you started a new project with C, the project could be obsolete long before your code works.

There are many options for fast code or fast development, Rust, Java, and others. They all have serious limitations without offering an advantage over PHP 7 for Web development.


Total cost of ownership (TCO) increases in priority every year. Software used to be a small proportion of the cost. Today hardware is cheaper, developers are paid less per hour and put in less hours to build a working Web site, everything is decreasing in code except software licensing. That means the software cost is rapidly increasing in proportion to everything else.

PHP is free. There is no purchase cost, no renewal cost, and no license management cost. PHP frameworks are free. You can completely bypass frameworks and move straight to a free open source content management system.

Compared to other languages, PHP creates far less disruption when you move to a new version, another big time and cost saving.


Your Web site needs an operating system, a Web server, a database/datastore, and a development language. PHP works on every useful operating system. PHP works with all the popular Web servers. PHP connects to all the useful databases and many that are not so useful. PHP works with all the other forms of data storage.

There are some frameworks that use unusually large amounts of memory. That is due to the framework, not PHP. The only tough choice you have to make with PHP is which framework or CMS.


People are your most valuable resource. You need only one third the number of people with PHP, compared to the best of the alternatives. You will also find PHP experts faster than for other languages. Existing staff can learn PHP, something that is just not practical with other languages.

When you move into framework selection, there can be differences in the availability of experts for the framework part of the development. Overall you are more likely to have the right people for every part of your project.


Javascript is heavily promoted as a replacement for PHP. Javascript is all over the place with versions and variations. Give Javascript a few years to settle down then look at Javascript.

Javascript has nothing to do with Java. Javascript was developed as something else by Netscape and shared only two things with Java, incredibly slow processing and gross unreliability.

Javascript went through many changes that never worked reliably, had problems with many Web browsers, and needed a server side workhorse to produce the content. PHP is the workhorse.

There are now server versions of Javascript but nothing with an advantage over PHP. The gap is closing. Current Javascript implementations push all the work down to the Web browser which then fails for several reasons. Users are hit with massive data download costs, timeouts due to the slow speed, and other crashes from all the inconsistencies in Javascript.

Always test your Web site with Javascript switched off. Ensure your customers can use your Web site when Javascript breaks. Test again with all Javascript blocked from outside your domain. Security conscious visitors will have every other domain blocked.

When using Javascript, always start with an extremely well tested library of Javascript code. jQuery is the only stable Javascript library I would trust today across a wide range of Web browsers.


For Web development, PHP is the number one choice. Other languages have their niche but not in Web development. Javascript is good for browser side processing and the one to watch for future server side processing.