3 Major Improvements that PHP 5.4 Offers

3 Major Improvements that PHP 5.4 Offers


Alright, PHP 5.4 is finally here and it has some vast improvements from it’s predecessor PHP 5.3 that are going to amaze anyone that is into web development, to say the least. These latest improvements have significantly improved PHP 5.4’s elegance while fine tuning the performance speed and reducing the memory usage. But let’s not jump the gun here, instead let’s go through the improvements one by one.

Advantages of PHP 5.4

Memory and Performance

A lot of the internal structures have been reduced in size or simply removed completely. What this has done is, it’s resulted in a huge range of memory saving. Approximately 20-50% in the larger applications. The performance is also up by about 10-30% although this is highly dependent on what you have designed your code to do. This was made possible through quite a few optimizations carried out such as: adding $GLOBALS to the JIT, several common code-paths have been inlined, the ‘@’ operator has been made much faster, through pre-computed hashes constant access has been made much faster, empty arrays consume very little or less memory and are much quicker, run-time string constants have been interned, all this and so much more performance and memory tweaking that has been made throughout the entire code.

Various tests have shown that some CMS’s load and run much more faster when operating under PHP 5.4. These are not negligible speed improvements. Some have gone up to 40% faster and used up to 30% less memory.

PHP 5.4 has over 100 bugs fixed and has significantly improved the memory footprint as well as performance. Features that have been removed or eliminated worth mentioning are: magic_quotes, register_globals and not forgetting safe_modes. Also what might interest you is knowing that multibyte support has or is enabled by default now and the default_charset has changed to UTF-8 from the previous ISO-8859-1.


One of the key new features, traits are a set of methods which structurally, are similar to a class but cannot be instantiated just like abstract classes and interfaces. Traits allow developers to use time and time again common method sets in more than one independent class. This circumnavigates the ‘single-inheritance’ problem that was inherent to PHP by allowing classes to use and inherit multiple traits.You can get the best demonstration of traits usage when the same functionality is shared by several classes.


The improvements in this area is that they have made it much shorter! Now when defining an array you no longer have to use the usual ‘array’ keyword. Arrays just so happen to be the matter that keeps PHP together. That is how powerful these constructs are. You can now use a much shorter syntax to define associative and numerical arrays. This new syntax has incorporated, as short hand, brackets. Moreover, dereferencing array elements from methods call and the result of function is supported now in this new version. With all the excitement, it is important to mention that the old method we are used to still and will go on working just as well.

Also worth mentioning is that there is an in-built HTTP server for development and testing purposes. And as far as closures are concerned, a new type hint that covers all call back option cases.

These are just some of the major improvements that PHP 5.4 brings to the table. Rather impressive and useful by any standards.


Open chat
Chat with our Experts!
Can I help you?