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.

Get Upgrading to PHP 5 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.