O'Reilly logo

Upgrading to PHP 5 by Adam Trachtenberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Additional New Features and Minor Changes

This appendix covers the changes made in PHP 5 that aren’t documented elsewhere in the book. Some sections discuss new features, such as the command-line processing options. Other sections contain slight modifications of existing features, such as what happens when you incorrectly treat a string as an array, or how strrpos( ) handles its needle. These fixes will trip you up if you’re relying on PHP 4 behavior.

Passing Optional Parameters by Reference

You can now pass optional parameters by reference. For example:

function updateAddress(&$address = 'NULL') {

}

In PHP 4, you could declare a parameter as either optional or pass-by-reference, but not both. PHP 5 removes this limitation.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required