✔ Variadic functions
<?php
class MySQL implements DB {
public function query($query, ...$params) {
$stmt = $this->pdo->prepare($query);
$stmt->execute($params);
return $stmt;
}
}
$q = 'SELECT * FROM users WHERE id = ?';
$user = $db->query($q, $userID)->fetch();
✔ Argument Unpacking
<?php
// A better call_user_func_args
$args1 = [1, 2, 3];
$args2 = [4, 5, 6];
test(...$args1, ...$args2); // [1, 2, 3, 4, 5, 6]
test(1, 2, 3, ...$args2); // [1, 2, 3, 4, 5, 6]
test(...$args1, 4, 5, 6); // Fatal error: Cannot use positional argument after argument unpacking
✔ Constant scalar expressions
<?php
class Foo {
const FOO = 1 + 1;
const BAR = 1 << 1;
const GREETING = "HELLO";
const BAZ = self::GREETING." WORLD!"
}
✔ Add right-associative power operator **
<?php
echo 2 ** 3 ** 2; // 512 (not 64)
echo -3 ** 2; // -9 (not 9)
echo 1 - 3 ** 2; // -8
echo ~3 ** 2; // -10 (not 16)
✔ Internal operator overloading for internal features like GMP
<?php
echo 2**512;
echo "\n";
$n = gmp_init(2);
echo $n**512;
1.3407807929943E+154
13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096
✔ use function and use const namespace imports
<?php
include 'template.inc';
include 'db.inc';
use function template\header, template\footer, db\query;
header('My Page');
query('select * from stuff');
footer();
✔ default_charset ini now applies to internal funcs
✔ SSL Peer verification by default
✔ openssl certificate fingerprints
✔ SAN x509 ext matching when verifying host names
✔ automatic DoS prevention of TLS renegotiation attacks
✔ and many more openssl-related options
✔ Asynchronous PostgreSQL database connections
✔ Non-blocking PostgreSQL queries
✔ New phpdbg SAPI
✔ Support for > 2GB file uploads
✔ The php://input stream is now re-usable
✔ Added hash_equals() for timing attack safe string comparison
✔ Added gost-crypto (CryptoPro S-box) hash algorithm
✔ FPM workers can now change their apparmor profile
✔ OCI8 Improvements