13.9. Summary

This chapter highlights some changes in PHP 5 that affect scripts written and working under PHP 4. A new object model and new OO features in PHP 5 mean that some OO scripts written for PHP 4 won't run correctly with PHP 5. If you cast an object to an int, the result is always 1, rather than 0 as in PHP 4. When you compare objects in PHP 5, true is returned only if the objects are the same, with the same object handle. The PHP 5 behavior for these three changes can be reverted to PHP 4 behavior by turning on Zend 1 compatibility mode in the php.ini file. However, two other changes cannot be reverted. In PHP 5, you can no longer assign an object to $this inside a class. In addition, the get_class() function in PHP 5 returns the class ...

Get PHP 5 Power Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.