'Hello'; } } trait World { public function sayWorld() { echo 'World'; } } class MyHelloWorld { use Hello, World; public function sayExclamationMark() {
0b001001101 Improved parse error messages and improved incompatible argument warnings The session extension can now track the upload progress of files Added a built in CLI web server (single threaded) e.g. php -S localhost:8000
and continue no longer accept variable arguments e.g. break 1 + foo() * $bar; Converting Array to String generates E_NOTICE. Result will still be "Array" Call-time pass by reference no longer allowed e.g. foo(&$bar) {} And many others...
supported: PASSWORD_DEFAULT PASSWORD_BCRYPT Password default is designed to change over time. Recommended to store passwords as 255 characters long to account for change in length as PHP is made more secure.
must use MySQLi or preferably PDO preg_replace /e modifier. Must now use preg_replace_callback() Some internationalisation functions around timezones Some mcrypt functions
Released 28th of August 2014 Supported until the 31st of December 2018 (yay)! Active support dies the end of this year. Security fixes only from the 31st of December 2016 (boo)
' have ' . count($albums) . ' album(s); } variadic('Oasis', 'Definitely Maybe', '(What's the Story) Morning Glory?' // Echoes Oasis have 3 albums And if anyone contradicts that they are lying
can now do the following <?php namespace Name\Space { const FOO = 42; function f() { echo __FUNCTION__ . "\n"; } } namespace { use const Name\Space\FOO; use function Name\Space\f; echo FOO . "\n"; f(); }
debugger default_charset used for htmlentities(), html_entity_decode() and htmlspecialchars() - Currently UTF-8 php://input can now be read multiple times File uploads larger than 2gb now accepted Magic method __debugInfo() allows you to modify object property and values when the object is output using var_dump() And many others...
own Andrea Faulds I checked and she has used MyTimetable... (cringe) Scalar type declarations come in two flavours: strict and coercive (default) Support strings, integers, floats and bools
definitions for throwaway objects <?php function anonymous_class() { return new class {}; } if (get_class(anonymous_class()) === get_class(anonymous_class())) { echo 'same class'; } else { echo 'different class'; } // Echoes same class
use __constructor() instead Static calls to non-static methods no longer allowed. Not sure why they were originally... password_hash() no longer accepts salts. It generates its own salt ldap_sort() deprecated