We have witnessed Facebook as a perceptional change in how people interact with others, also it has triggered the change in the technology stack; specially for PHP. Inspired from Facebook HVVM for Just In Time compilation in PHP, the source team led by ZEND added huge performance improvements to the PHP released as PHP7. We never witnessed PHP6 though as it never reached to stable version after PHP5.6

In this post we are going to list out some of changes and new features quickly.

Functions changed : there are plenty listed on php.net website for documentation but most commonly used ones aremktime() – the is_dst for day light saving parameter has been removed (default UTC).preg_replace() – now â€œ\eâ€ modifier has no effect.setlocale() – Only LC_* constants allowed.substr() – expect empty string instead of FALSE.

Removed extensions : Commonly used mssql, mysql extensions has been removed now. Instead use sqlsrv or pdo for mssql, mysqli for data connections.

There have been multiple changes but listing them all will be too much information here, so only frequently used functions / extensions have been listed above.

Now as a programmer how it will affect you?
Well, there are good news due to JIT for performance without doubt but you might need to see it in action by trying yourself. Below are some changes in our way of writing PHP code just because of PHP7.

Return Types: Since days of C language we had envisioned the return types for functions, and now its here in php too. It helps a lot to avoid var dump and echo statements to dig down the reason in debug cases frequently as you can specify and expect exact return type.

prior PHP7

public function someFunction($inputType)
{
// some business logic
â€¦..
return true; // also you can return 1234 or string or any type
}

PHP7

public function someFunction($inputType) :bool
{
// some business logic
â€¦..
return true; // RETURN TYPE is set now so only bool
}

Null coalesce operator: The coalesce operator ?? has been added to core thus log null condition match syntax has become shorter and cleaner.

How you are getting along with PHP7? Do you like it over PHP5.6?
On performance note PHP5.6 introduced OpCache which was already good for improved performance by good margin but with changes in core with JIT support new version just wins head down, only possible constraint is “the change” as even experienced programmers might need to align themselves ;).