php 5.5 new and deprecated features

Since php 5.5 is out now, There are some cool features and deprecated features I like to mentioned here.

PHP 5.5 New features

“Generators” support added
Support for generators has been added via the yield keyword. Generators provide an easy way to implement simple iterators without the overhead or complexity of implementing a class that implements the Iterator interface.

“Finally” keyword support added
try-catch blocks now support a finally block for code that should be run regardless of whether an exception has been thrown or not.

foreach now supports list()
The foreach control structure now supports unpacking nested arrays into separate variables via the list() construct.

empty() supports arbitrary expressions
Passing an arbitrary expression instead of a variable to empty() is now supported.

array and string literal dereferencing
Array and string literals can now be dereferenced directly to access individual elements and characters:

New password hashing API
A new password hashing API that makes it easier to securely hash and manage passwords using the same underlying library as crypt() in PHP has been added.

Apache 2.4 handler supported on Windows
The Apache 2.4 handler SAPI is now supported on Windows.

Improvements to GD
Various improvements have been made to the GD extension

php 5.5 deprecated features

ext/mysql deprecation
The original MySQL extension is now deprecated, and will generate E_DEPRECATED errors when connecting to a database. Instead, use the MySQLi or PDO_MySQL extensions.

preg_replace() /e modifier
The preg_replace() /e modifier is now deprecated. Instead, use the preg_replace_callback() function.

intl deprecations
IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() are now deprecated. Instead, use the IntlDateFormatter::setTimeZone() method and datefmt_set_timezone() function, respectively.

mcrypt deprecations
The following functions have been deprecated:
mcrypt_cbc()
mcrypt_cfb()
mcrypt_ecb()
mcrypt_ofb()

Ref1. http://www.php.net/manual/en/migration55.new-features.php
Ref2. http://www.php.net/manual/en/migration55.deprecated.php

Leave a Reply

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


9 − six =