The major PHP Version 7.4 is set to be released November 28th 2019. All indicators are that it will again make PHP faster, building on the improvments 7.2 and 7.3 saw.
PHP version 7.4 even at its dev stage is faster than 7.3 by a fair margin. Astounding after all these years the language can still be optimized to be getting faster.
PHP 7.4 beta 2 was released on August the 8th 2019 and beta 4 was August the 22nd 2019. This beta in the development cycle gives indication the main branch isnt far away. You can view the full PHP 7.4 version timeline here.
New features
The 7.4 new features can be found here. Whilst not greatly “exciting” it is always interesting to see what is being included and created.
Typed properties
Assign types for class properties:
class animal { public int $type; public string $name; public boolean $endangered public function __construct(int $type, string $name, boolean $endangered) { $this->type = $type; $this->name = $name; $this->endangered = $endangered; } }
Here $type
can ONLY be assigned as an int, $name
a string and $endangered
a boolean.
Null Coalescing Assignment Operator
$data['uid'] = $data['uid'] ?? '05136';
Can now be written as
$data['uid'] ??= '05136';
Which does the same, thus making operators shorter.
Unpacking inside arrays
The ability to put a same structured array into an existing one at a certain point
$extra = ['Sam', 'Will']; $names = ['Bill', 'Steve', 'John' ...$extra, 'Andy']; // ['Bill', 'Steve', 'John' 'Sam, 'Will', 'Andy'];
Underscores in numerals
1.285_415e-24; // float
Several more new features can be found in the official docs here. There honestly isnt a massive amount of additions buts thats ok, If (as early tests show) PHP 7.4 is faster than 7.3 every one will be happy.
Depreciations
Taken straight from the docs the main depreciated functions are :
. Passing invalid characters to ''base_convert()'', ''bindec()'', ''octdec()'' and ''hexdec()'' will now generate a deprecation notice. The result will still be computed as if the invalid characters did not exist. Leading and trailing whitespace, as well as prefixes of type 0x (depending on base) continue to be allowed. . Using array_key_exists() on objects is deprecated. Instead either isset() or property_exists() should be used. . The is_real() function is deprecated, use is_float() instead. . The get_magic_quotes_gpc() and get_magic_quotes_runtime() functions are deprecated. They always return false. . The hebrevc() function is deprecated. It can be replaced with nl2br(hebrev($str)), or preferably the use of Unicode RTL support. . The convert_cyr_string() function is deprecated. It can be replaced by one of mb_convert_string(), iconv() or UConverter. . The money_format() function is deprecated. It can be replaced by the intl NumberFormatter functionality. . The ezmlm_hash() function is deprecated. . The restore_include_path() function is deprecated. It can be replaced by ini_restore('include_path'). . Passing parameters to implode() in reverse order is deprecated, use implode($glue, $parts) instead of implode($parts, $glue).
Obviously all the soon to be collapsed functions have alternatives, many of these soon to be gone functions are from the very early releases of PHP.
Finally the release of 7.4 will be more than a year from version 8.0 which is said to be coming early 2021. This is a major version because it will be JIT just in time compilation.
JIT will make the CPU entensive processes run quicker. Just check out these results.