Top 10 Improvements in PHP 5.5.0

Top 10 Improvements in PHP 5.5.0
March 8, 2019 Seo Essence
Top 10 Improvements in PHP 5.5.0

One key difference to remember before upgrading is that support for  XP and 2003 has been dropped adjusted 5. 5. 0.

  • Generators at the moment are available

Generators provide a simple strategy to iterate through data while not having to write a class implementing your Iterator interface.

Just like another function a generator is defined while using the function keyword, but unlike a usual function that just returns an end result once, a generator can send back several results as needed using this yield keyword.

  • Finally keyword added

The addition of the "finally" keyword refines the best way that PHP deals with exception to this rule handling.

Like other high level languages PHP means that you can wrap code in an aim to catch block. Any exception that is certainly thrown by code within the try block will likely be passed to code within the catch block for being handled.

The finally keyword means that you can define a block of value, to be placed after this catch block, that will regularly be  executed after the try  in addition to  catch blocks, regardless of  no matter if an exception was thrown.

  • Completely new password hashing API

The new password hashing API permits you to use one line of code to come up with a salted password hash applying bcrypt. For example:

$hash = password_hash($password, PASSWORD_DEFAULT);

password_hash() normally takes  two arguments here, first the password as a string and second consistent  setting the encryption algorithm  make use of.

The password will be automatically salted which enables it to be verified using the following code:

password_verify($password, $hash);

The current default encryption algorithm used is bcrypt, although it is expected to change as completely new and stronger algorithms are included in PHP.

It is recommended to store the spark a database column that can grow beyond 60 characters.

  • Array and string literal differencing added

Both array and string literals are now able to be dereferences directly to gain access to individual elements and characters.

  • Much easier class name resolution

The class keyword is now able to be used to retrieve the fully qualified name of any class, including the namespace the item sits within.

  • Empty () function accepts expressions

The empty() function, helpful to  determine whether a variable is empty or maybe a value equals false, can now be passed a manifestation  and determine whether the changing  that expression returns is empty.

  • Support for the Zend Optimiser+ opcode cache included

The Zend Optimiser+ opcode cache has become added to PHP as the revolutionary OPcache extension.

OPcache improves performance of scripts by removing your need for PHP to load and parse scripts each time a request is made. It achieves this by means of storing precompiled script bytecode with shared memory.

  • foreach loops  at this point support the list() construct

Values insides nested arrays is now able to be assigned to variables having a foreach() loop and the list() assemble.

List () can be used to easily assign values removed from inside an array to variables, like so.

  • New features included in GD library

PHP's GD extension for creating and manipulating images has gained new capabilities. Like for example, flipping support using the completely new imageflip() function, advanced cropping support using this imagecrop() and imagecropauto() functions, and WebP read and write support when using the imagecreatefromwebp() and imagewebp() functions.

  • foreach loops now support non-scalar keys

When iterating using an array using a for each loop, element keys is now able to get a non-scalar value that is a value in addition to an integer or a string.