All you need to know about PHP 7

It’s been 11 years since the inaugural PHP release. And with access to the PHP 7 features in the latest edition racing ever closer, 2015 and 2016 are expected to be big years for one of the world’s most popular programming languages.On November 26, the PHP development team announced the thirteenth pre-release of PHP 7.0.0. In new PHP version fix some security issue and also some functions and features.

All you need to know about php7


PHP 7 updates :

Speed. PHP 7 will be twice as fast as PHP 5.6 now equipped with a new version of the core scripting engine for PHP — Zend Engine. Applications will run much faster and smoother than before.

Performance: It’s top-of-mind for any language update. Here’s how the PHP 7 features in the latest release will stand out.

Memory: The latest release will use approximately two thirds of the memory it previously did. That means three times the throughput as PHP 5.6.

phpng: PHP Next Generation has been merged with the master branch of PHP improving overall performance. PHP 7 will be able to manage twice as many WordPress requests per second.

Support. PHP 7 will offer consistent 64-bit support.

You can handled the exceptions in php7 differently :

Script that would result in a fatal error in past versions of PHP will now be handled as exceptions.Prior to PHP 7, fatal errors and recoverable errors would halt the script execution without throwing an exception.This means that these errors could not be handled like exceptions and presented in any desirable way to the user.In PHP 7, if the script reaches a fatal error, it throws an error exception, which can be handled like a regular exception with the try/catch block and execute the finally block afterwards (if present). This new method allows us to present most fatal and recoverable errors to the users, the way we want. Some type of fatal errors will still halt script execution (like running out of memory, for example).


Breaks in backwards compatibility with new PHP 7 features :
It will be especially important to avoid or rewrite deprecated code with the recommended PHP tag. Our architects compiled the compatibility changes with the potential to be most trouble.

Changes to error and exception handling :
Most of the applications use some kind of error handling. In this case, there might be cases where those custom handlers won’t be triggered because exceptions will be thrown.

Changes to the handling of indirect variables, properties, and methods : 
This update is important for most of the applications and needs to be considered with priority.

Empty list() assignments have been removed. This is also important to keep in mind, because empty lists are usually used.

Changes to Division By Zero:
There might be cases where an error will be thrown instead of a warning. This will affect the production environment where warnings are suppressed.


What was removed from PHP?
GD Type1 functions changes
ASP and script PHP tags
Calls from incompatible context
$HTTP_RAW_POST_DATA

New capabilities in PHP 7 : 

Beyond grooming deprecated functionality out of PHP 7, the team working on PHP 7 included a host of new functionality.

Closure functions. With Closure functions, we are able to use benefits from functional programming. We can use arrow functions (anonymous functions), and we have a new keyword yield.

Error handling and logging. We can create a custom errors, we can add a log of errors and we can error stack trace.

CSPRNG. With CSPRNG, we are able to generate crypto-strong random integers and bytes.

Matching. PCRE Functions::preg_replace_callback_array with this function we can run arrow functions, when we have matching.

Specification. With ZipArchive, developers can specify compression index.

Deflate. Zlib Compression offers four new functions for working with deflate.




No comments:

Post a Comment

Download the eBook of react js for beginners

ReactJS basically is an open-source JavaScript library which is used for building user interfaces specifically for single page applications...

Popular