What's New in PHP 7.2? - PHP Updates | Advance Idea Infotech

by jay patel

In this article, we discuss some of the newer parts of the PHP language that were released during its latest iteration, such as improved security.

As we all know, most web developers either love or hate PHP with a passion. I'm one of those developers that absolutely love it. I know PHP like the back of my hand. Now, since 7.2 has been released, my love is growing even more! Let's talk about the awesomeness that the newest version brings to us.

Security Is the Most Important Thing Here

The 7.2 Release offers some highly needed improvements to security.

Libsodium is Part of the Core

The application-layer cryptography library Libsodium is now part of the core in PHP 7.2. Previously, the library was made available through PECL, another recursive acronym meaning “PHP Extension Community Library.”

The inclusion of Libsodium makes PHP the first programming language to add modern cryptography to its standard library.This ensures the cross platform and cross-languages library enables encryption, decryption, signatures, password hashing, and much more.

Argon 2 in Password Hash

Argon 2 is an award-winning hashing algorithm. It won the 2015 Password Hashing Competition, bringing a secure alternative to the Bcrypt algorithm on previous version of PHP. It is designed for the highest memory filling rate and effective use multiple computing units while still providing defense against tradeoff attacks. Bcrypt only allows for one cost factor, whereas Argon 2 takes three cost factors: memory cost, time cost, and parallelism factor.

The memory cost factor defines the number of KiB that should be consumed during hashing, while the time cost defines the number of iterations of the hashtag algorithm. The parallelism factor sets the number of parallel threads that will be used during the hashtag. See more information on how Argon 2 addresses these factors here.


According to benchmarks from Phoronix, PHP 7.2 runs 13% faster than 7.1 and 20% faster than 7.0. It’s 250% faster than PHP 5.6, which over 40% of WordPress users still have not updated from. Other tests support these findings. Official PHP benchmarks demonstrate that PHP 7 is twice as fast as 5.6 with half the latency.


As with each update, there are several deprecated functions and features which will be removed no later than PHP 8.0. The full of list deprecated functions can be found here. These features will work in PHP 7.2, but error messages will appear during use in log files. Developers should check the code to update any deprecated functions before they become backwards incompatible.


PHP 7.0 reached the end of its security support on December 3rd, 2017. Critical support will still be available through the end of 2018, but the PHP community no longer provides support for bugs or minor issues. PHP 7.1 will follow suit on December 1st, 2018. Upgrading to 7.2 ensures the latest security updates are supported continuously by the community.

Improved Programming Language Features

There are other updates to help fix some people's complaints about the language. So, here we go.

  • A new warning has been added when calling the count () function with a parameter that is a scalar, a parameter that is null, or an object that does not implement the Countable interface.
  • Object typehints fix a situation in which a developer can't declare a function that needs to be passed an object as a parameter or declare that a function should return an object. The fix uses object as a parameter type and as a return type.
  • HashContext as Object migrates the hash extension to use an object extension for hash contexts instead of using resources.
  • Conversion of numeric keys in object/array casts addresses an issue with the Zend Engine, which powers PHP 7. The engine has cases in which array hash tables can contain numeric strings, while object hash tables can have integer keys. In such cases, PHP code can't find the keys. With the fix in PHP 7.2, keys of arrays or object hash tables are converted as appropriate, so numeric string property names in objects become integer array keys and vice versa, solving the issue of inaccessible properties.

Want to work with experts in PHP and other web development technologies? Contact us or email our web development department at info@advanceidea.co.in.

Leave a Reply

Your email address will not be published. Required fields are marked *

   Confirm you are not a spammer
   Notify me of follow-up comments by email.