Namespaces (5.3) Namespaces are for combining libraries in one project. • we keep our own code in its own namespace(s) • we can pick-and-mix other people's code • class names don't have crazy long prefixes • combined with PSR standards, they enable Composer
Register Globals is Gone (5.4) Upgrade PHP and see many undefined (simple) variables. To fix each undefined variable: • replace $username with $_GET['username'] or $_POST['username'] in each case
Timezone Settings (5.4) PHP refuses to guess the timezone and will warn you. It is not safe to rely on the system's timezone settin You are *required* to use the date.timezone setting or date_default_timezone_set() function. In case you used any of those methods and you are stil warning, you most likely misspelled the timezone ident Fix it by setting date.timezone in php.ini: date.timezone = "Europe/London"
Call Time Pass By Reference PHP Fatal error: Call-time pass-by-reference has been This error says "don't pass references in when the function didn't expect them, you fool"
Call Time Pass By Reference You can pass by reference. Declare function: 1 function inspire(&$person) { 2 // be inspiring 3 } Call with just $ and not & 1 inspire($current_user);
Use PHPCodeSniffer Use the PHPCompatibility PHPCS standard Install from https://github.com/wimg/PHPCompatibility and include in your standards directory
Use Continuous Integration Builds Use something like http://travis-ci.com to run regular builds This can run your build steps for various versions of PHP each time you commit (it's free for open source users)
Check Your Code Is Ready • Use the PHPCompatibility PHPCS standard • Turn on E_DEPRECATED and watch the logs of your existing platform • Lint check with new version (php -l) • Run application with PHP's webserver