What's New in PHP 7.2?: Literally Better Everything

DZone 's Guide to

What's New in PHP 7.2?: Literally Better Everything

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.

· Web Dev Zone ·
Free Resource

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.

  1. The Libsodium cryptography library, for authenticated encryption and high-speed elliptic cryptography, is now a core extension. I've been waiting for this to happen for a while now.
  2. The Argon2 algorithm for hashing passwords addresses my personal downsides of the current algorithms, in that they were designed for the highest memory filling rate.
  3. Bye bye Mcrypt. The Mcrypt cryptography library extension has been officially removed. PHP's developers have said that Mcrypt greatly inhibited the growth of the PHP language and served as "abandonware."
  4. SSL/TLS (Secure Sockets Layer/Transport Layer Security) constants have been improved.

Improved Programming Language Features

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

  1. 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.
  2. 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.
  3. HashContext as Object migrates the hash extension to use an object extension for hash contexts instead of using resources.
  4. 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.
web dev ,php ,web application security ,web application development

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}