O'Reilly logo

PHP 5 Power Programming by Derick Rethans, Stig Sæther Bakken, Andi Gutmans

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

13.4. Compatibility Mode

In an earlier section, one suggested solution was to turn on the compatibility mode. This mode actually changes more behavior than just the pass-by-reference behavior. It also affects other Zend Engine 2 (PHP 5) related changes. Turning on Zend Engine 1 (PHP 4) compatibility mode changes the following:

  • Passing objects to a function results in a copy of the object (discussed in the previous section).

  • Casting an object to a Boolean, integer, or double results in 0 if the object has no properties.

  • Comparing objects results in true when the properties of the two objects have the same content.

13.4.1. Casting Objects

In PHP 4, (int) $object returns 1 if the object has properties or 0 if the object has no properties. This is ...

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