PHP:An obsolete choice or a language of relevance on web?

14 April, 2021 Amandeep Singh - Development lead

PHP emerged as a natural ally for web development over the past decades of digital revolution on internet. From almost an experimental effort of Rasmus Lerdorf in 1994 who referred to it as “Personal Home Page”, this soon became the ubiquitous choice of websites. However, with other options arriving like Ruby and RoR, Python, not to speak of already existing competitors like the jsp, asp.net, etc, a question that is often asked is if PHP is fast becoming obsolete? Well, doesn’t look like!

Recent usage statistics by W3Techs.com, PHP is used for server-side programming by 79.2% of all the websites even today. However, PHP has come a long way from PHP 3.0 to PHP 7.0 and is now on its way to PHP 8.0. A relative assessment of various versions of PHP being used in PHP based sites shows that these sites adapted to such transitions quite well. As of today, while most of the sites have moved on to PHP 7.0, many are in the process of this transition. It is therefore, anyone’s guess that when PHP 8.0 stabilizes, this loyalty shall stay with the scripting language.

The question therefore remains Why does PHP continue to be the web’s favorite?

Before we answer this question, let us see how this language evolved to address the changes in technology.

PHP 3.0
PHP 3.0 was the first version that closely resembles PHP as it exists today.Zeev Suraski and Andi Gutmans realized that PHP was lacking some common features. They decided to rewrite the scripting language, so they teamed up with Rasmus to launch PHP 3. PHP 3 came with limited object-oriented support that added extra fuel to the growth of PHP. Some of its features were

  • API Extension
  • Object-Oriented Support
  • Introduction of Zend Engine

PHP 4.0
After the work on rewriting the core of PHP started, the next version of PHP that got released was PHP 4.0 in 2000. The PHP 4.0 introduced several new features including:

  • Improved performance of complex applications
  • Improvement in PHP’s code base modularity
  • Support for a large array of web servers.
  • Secure ways for handling user input.
  • Introduction of the new engine – Zend.

PHP 5.0
After almost four years of introduction of PHP 4.0, the new version of this server side scripting language was introduced. This version gave PHP an unprecedented popularity and acceptance, and PHP made its mark on millions of servers across the globe. The major features offered by this newer version of PHP included:

  • New Zend Engine 2.0 that was integrated with a new object model
  • XML support with excellent libxml2 library
  • SimpleXML extension that made it easier to access and manipulate XML as PHP objects
  • Support for MySQL’s several new features
  • Enhanced MySQL extension

PHP 7.0
This is the most current version of PHP which is in use today, and it was introduced in 2014 with colossal performance improvements. This version of PHP was up to twice as fast as its predecessor, PHP 5.6 and introduced many imperative enhancements while deprecating the features from the previous branch. Some of the top improvements introduced with PHP 7.0 include:

  • Uses PHPNG or Next Generation Engine
  • Improved exception hierarchy
  • Anonymous classes
  • Reduced memory usage
  • Conversion of many fatal errors to Exceptions
  • Scalar and Return type declarations
  • The null coalescing operator (??)
  • Unsupported APIs and extensions removal
  • Secure random number generator
  • Consistent 64-bit support

Considering that the recent significant transition is from PHP5 to PHP7, this article shall focus on just these for the moment.

Feature PHP 5 PHP 7
Speed and Performance Uses Zend II engine. Offers High speed, but insufficient for developer’s requirements. Designed to increase performance, ensures faster loading of websites and increased performance of scripting.
64 Bit Supported not Supported Supported
Handling of Fatal Errors difficult to handle With PHP7, handling fatal errors is effortless
Return Type PHP5 is not integrated with functionalities return type of a function can be declared
Memory Consume more memory Consume less memory
Security Less secure More secure

So while there are many limitations that PHP needs to overcome as it evolves, the reason why developers prefer to use PHP are

  • It belongs to Open Source Philosophy
  • Has a supportive community
  • Offers cross platform development
  • It is easy to learn
  • Can be integrated with various extensions and add ons
  • Supports various Database Management Systems – SQL and NoSQL

This blog is authored by Amandeep Singh, Development Lead, IDEA Foundation