New FeaturesPHP CoreTyped propertiesClass properties now support type declarations.
$user->id can only be
assigned int values and $user->name can
only be assigned string values.
Arrow functionsArrow functions provide a shorthand syntax for defining functions with implicit by-value scope binding.
Limited return type covariance and argument type contravarianceThe following code will now work:
Null coalescing assignment operator
Unpacking inside arrays
Numeric literal separatorNumeric literals can contain underscores between digits.
Weak referencesWeak references allow the programmer to retain a reference to an object that does not prevent the object from being destroyed. Allow exceptions from __toString()Throwing exceptions from __toString() is now permitted. Previously this resulted in a fatal error. Existing recoverable fatal errors in string conversions have been converted to Error exceptions. CURLCURLFile now supports stream wrappers in addition to plain file names, if the extension has been built against libcurl >= 7.56.0. Filter
The FFIFFI is a new extension, which provides a simple way to call native functions, access native variables, and create/access data structures defined in C libraries. GD
Added the Hash
Added Multibyte StringAdded the mb_str_split function, which provides the same functionality as str_split, but operating on code points rather than bytes. OPcacheSupport for preloading code has been added. Regular Expressions (Perl-Compatible)
The preg_replace_callback and preg_replace_callback_array
functions now accept an additional PDOThe username and password can now be specified as part of the PDO DSN for the mysql, mssql, sybase, dblib, firebird and oci drivers. Previously this was only supported by the pgsql driver. If a username/password is specified both in the constructor and the DSN, the constructor takes precedence.
It is now possible to escape question marks in SQL queries to avoid them
being interpreted as parameter placeholders. Writing PDO_OCIPDOStatement::getColumnMeta is now available. PDO_SQLite
SQLite3Added SQLite3::lastExtendedErrorCode to fetch the last extended result code.
Added Standardstrip_tags() with array of tag names
strip_tags now also accepts an array of allowed tags:
instead of Custom object serialization
A new mechanism for custom object serialization has been added, which
uses two new magic methods:
Array merge functions without arguments
array_merge and array_merge_recursive
may now be called without any arguments, in which case they will return an empty array.
This is useful in conjunction with the spread operator, e.g. proc_open functionproc_open now accepts an array instead of a string for the command. In this case the process will be opened directly (without going through a shell) and PHP will take care of any necessary argument escaping.
proc_open now supports
argon2i(d) without libargonpassword_hash now has the argon2i and argon2id implementations from the sodium extension when PHP is built without libargon. |