Class and object changesinstanceof, is_a(), is_subclass_of() and catch
In PHP 5.0, is_a() was deprecated and replaced by the
instanceof operator. There were some issues with the
initial implementation of instanceof, which relied on
__autoload() to search for missing classes.
If the class was not present, instanceof would throw
a fatal None of these functions or operators call __autoload() in PHP 5.1.x, and the class_exists() workarounds used in code written for PHP 5.0.x, while not problematic in any way, are no longer necessary. Abstract private methodsAbstract private methods were supported between PHP 5.0.0 and PHP 5.0.4, but were then disallowed on the grounds that the behaviours of private and abstract are mutually exclusive. Access modifiers in interfaces
Under PHP 5.0, function declarations in interfaces were treated in exactly
the same way as function declarations in classes. This has not been the
case since October 2004, at which point only the public
access modifier was allowed in interface function declarations. Since
April 2005 - which pre-dates the PHP 5.0b1 release - the
static modifier has also been allowed. However, the
protected and private modifiers will
now throw an Changes in inheritance rulesUnder PHP 5.0, it was possible to have a function declaration in a derived class that did not match the declaration of the same function in the base class, e.g.
This code will cause an
<?php Class constantsUnder PHP 5.0.x, the following code was valid:
Under PHP 5.1.x, redefinition of a class constant will throw a fatal
<?php |