New features in PHP 5.5 - The latest version of PHP version 5.5 provides many news features for the development of application in PHP framework
The PHP 5.5 is the latest release of PHP framework which comes with many new enhancement and features. There are many new exiting features which is added to the PHP 5.5 framework. In this tutorial we will discuss the new functionality added and understand the benefits of these features for the development of web applications.
Here are the important features of PHP 5.5
1. Generators
Now Generators are available in PHP. The Generators are used to iterate through data without writing a class to Iterator interface.
2. The "finally" keyword is added in PHP
Now you can use the finally keyword while catching the exception in PHP.
try{
//Some logic
}catch(Exception $e){
//Do something
}finally {
echo "Final block";
}
3. The new password hashing API is now available in PHP 5.5
Here is the syntax of using the the password hashing API:
$hash = password_hash($password, PASSWORD_DEFAULT);
and you can can match the password using following code:
password_verify($password, $hash);
4. In PHP 5.5 Array and string literal deferencing added
In this version of PHP both array and string literals can now be dereferenced directly. It allows to access individual elements and characters.
5. In PHP 5.5 you can easily resolve the class names
6. Now Empty() function can be used to accept the expressions
Example:
if (empty(true)) {
echo "Its true";
}
7. Now PHP 5.5 provides support for the Zend Optimiser+ opcode. Which provides great performance enhancements.
8. Now you can use the list() construct in foreach loops
Example:
$array = [
[1, 2],
[3, 4],
[6, 6],
];
foreach ($array as list($first, $second)) {
echo "First Index: $first; Second Index: $second";
}
9. GD library enhancements
New GD functions added in PHP 5.5 are:
- imageflip()
- imagecrop()
- imagecropauto()
- imagecreatefromwebp()
- imagewebp()
10. Support for non-scalar keys in foreach loops 0
11. OPCache Support
Now PHP 5.5 provides in-build support for OPCache.
12. array_column() 1
The new array_column() function is used to get a single column data form given multidimensional array.
13. Many deprecated and other functions are removed
- ext/mysql deprecated
- Dropped Windows XP and 2003 support.
- The preg_replace()is deprecated and now you can use preg_replace_callback() method
- Logo GUIDs removed
Related PHP Tutorials 2
Here are the top Tutorials of PHP:
- PHP Tutorial
- Starting PHP
- PHP MySQL
- Zend FrameWork
- Starting PHP
Learn the basics of PHP with this quick and simple tutorial. Designed for the very beginners.
- PHP Cookies
Cookies are little packets of information that are stored locally on a computer system when you visit a website that utilizes them.
- File Manipulation in PHP
In this tutorial we will learn how to write data to a flat file database (text document) using this tutorial
- PHP displaying the time and date into your timezone
For a lot of people, when they use the date() function in PHP, it doesn't display the correct time and date for their region, as their servers may be in a different part of the world to where they are.