bookmark_borderWhat is the difference between PHP 5 and PHP 7?

The Hypertext Preprocessor (PHP) is a very popular scripting language. It’s been a standard since 1994 due to its attractive features. Safer connectivity to the database, faster speed, runs smoothly on the most used platforms (Windows, Unix, Linux). Of course, there were many improvements, but let’s have a closer look at PHP 5 and PHP 7.

PHP 5 main features.

PHP5 was developed considerably more robust than PHP 4. The Zend II engine powered it. It offered an improved mechanism for handling exceptions and errors, a model oriented to objects that supplies interfaces, abstract classes, constructors, static and final properties. Besides, it had SSL connections, multi-query functions for MySQL extension. PHP5’s XML extensions were enhanced, just like the soap implementation for providing and consuming web services, speed, and performance.

PHP 7 main features.

PHP 7 was the successor of PHP 5. Its performance was better than the PHP 5. It was powered by a PHP-NG (Next Generation) engine. It achieved twice the PHP 5 performance and 50% less memory consumption to give a reference. It added anonymous classes, removal of deprecated methods, better exception hierarchy and handling, more efficient memory use, abstract syntax tree, and support for return type declarations. Besides, it included scalar type declarations for better controlling the code, CSPRNG functions, spaceship operator (three-way comparison), constant arrays using define (). 

What is the difference between PHP 5 and PHP 7?

  • Performance. And PHP 7 speed got double than the one offered by PHP 5. While PHP 5 (Zend II engine) handled an average of 22 requests per second, PHP 7 (PHP-NG engine) made 44. So PHP 7 totally boosted the scripting performance and websites’ loading speed.
  • Exception handling. Handling fatal errors with PHP 5 was hard for developers, mostly because errors were not displayed directly. You needed to trace the information to find it and to identify if it was fatal or not for an application. On PHP 7, important errors became exceptions to be caught easier.
  • Return type. PHP5 didn’t include a provision for return type declarations. This feature was added to PHP 7 version, making the code more accurate. The available return types were: float, string, bool, int.
  • Null coalescing operator ?? On PHP 5, you had to write explicit code to return the null value in the case the value was not available (it didn’t exist). On PHP 7, you could just use the operator ?? (two question marks) to return a variable’s value if it was available or for returning null if it was not available.
  • Spaceship operator (combined or three-way comparison). With PHP 5, many different operators were used for comparing. PHP 7 integrated the three-way comparison operator (<=>), meaning that with a single operator, three kinds of comparisons were possible to do simultaneously: greater than, less than, and equal. It returned 0, meaning equal, -1 if the right part was greater than the left, and 1 in the opposite scenario.
  • Declarations. PHP 5 worked with individual declarations for namespaces. PHP 7 simplified the task through the use of group declaration. This made code more compact and easy to read. It definitely meant less time typing for programmers. 
  • 64-bit support. While PHP5 didn’t support 64-bit, PHP7 did, the complete 64-bit and large files. Running applications smoothly on these architectures was not a problem anymore.
  • Anonymous class. It was included on PHP 7. Then, creating a complete definition of a class required just once in the whole application was not needed anymore. Instead, an anonymous class for a single-use got possible. 


The jump from PHP 5 to PHP 7 was key for PHP to evolve and become a more useful scripting language. Currently, we are on PHP 8 (8.0.8 version). Stop imagining the possibilities. Better experience them now!

bookmark_borderPHP Version 5 – everything you need to know


PHP 5 was released on 1 July 2004. That is 4 years after introducing PHP 4 to the scene of the Internet. The aim is to bring a lot of new functionalities to the PHP language. The focus of the team was on what is not very well supported and what is missing in the previous versions. The focus of the new PHP 5 version is on 3 major areas: Object-Oriented programming, XML, and MySQL support.

Object-Oriented programming

This feature was present in PHP 4, but in PHP 5 it is introduced an entirely reworked object model. It now offers:

  • Interfaces
  • Destructors
  • Constructors
  • Protected, private, and public properties and methods
  • Class type hints
  • Abstract classes
  • Final properties and methods
  • Static properties and methods
  • Magical methods

Programmers in PHP 5 are able not just to pass objects by value but also by reference.

Reworked MySQL extension

The MySQL extension is completely reworked in PHP 5. It provides support for MySQLi, which is the new version of MySQL. It means MySQL improved. This new extension offers:

  • Bound input and output parameters
  • Prepared statements
  • SSL connections
  • MySQL can now apply PHP’s new OO model
  • Multi-query functions

Reworked XML extension

XML tools were great for the job in PHP 4. Except, they were not actually designed to operate together, and often patches were necessary to complete the required functionality. In PHP 5 is applied a reworked XML parser with tools capable of operating with one another. Furthermore:

  • They are included in a single XML library: libxml2.
  • XML extensions can operate together as a whole.
  • They provide efficient data processing. 
  • XML extensions can provide you with the exact XML tool for the task.
  • They comply fully with W3 specifications.

The SimpleXML extension is also introduced in PHP 5. It allows you to handle the data in XML documents easily. It treats it as an array and looping through it.

Release history of PHP 5

5.0 version. PHP 5 was released powered by Zend Engine II with a new object model.

5.1 version. For accessing databases was added PHP Data Objects (PDO) as a lightweight, consistent interface. Improvements in performance with the introduction of compiler variables in re-engineered PHP Engine. 

5.2 version. Native JSON support. The filter extension is enabled by default. 

5.3 version. New features are Namespace support, late static bindings, jump label. Also, the Windows support is improved. Further added features like, sqlite3, and mysqlnd replacing libmysql as an underlying library for the extensions that operate with MySQL.

5.4 version. New features are trait support and short array syntax support. In addition, some improvements are made to the current performance and features, plus decreased memory requirements.

5.5 version. Further support for generators and finally blocks for exceptions handling. OpCache (based on Zend Optimizer+) in a set in the official distribution.

5.6 version. Constant scalar expressions, possible large file uploads, new interactive “phpdbg” debugger as a SAPI module, and other more minor improvements.

Is PHP 5.6 still supported?

If we have to give a short answer, it is “No.” This is because PHP developers are no longer supporting PHP 5.6 or any other version of PHP 5. On 31 December 2018, officially ended the support of PHP 5.6. 


  • There won’t be any more security updates.
  • There won’t be any more bug fixes.
  • In a production environment, you should not use PHP 5.6 or any version of PHP 5. 
  • For security reasons, you should no longer use PHP 5. There are many out-of-date libraries and functions.