note 71700 deleted from function.get-class-methods by bobby
| From: | bobby@php.net | Date: | Wed, 03 Jan 2007 15:26:43 +0000 |
| Subject: | note 71700 deleted from function.get-class-methods by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121254@lists.php.net to get a copy of this message | ||
Note Submitter: robert dot hunter at m3 dot net
----
get_class_methods() provides very different results for inherited constructors on PHP4 and PHP5.
In fact, PHP5 gives you *duplicate* entries for constructors named after the class (PHP4-style
constructors).
A demonstration:
<?php
class BaseWithConstructor
{
function BaseWithConstructor()
{
// only occurs with PHP4-style constructor
// rename to __construct() to see different behaviour
}
}
class EmptySubclass extends BaseWithConstructor {}
$base_methods = get_class_methods('BaseWithConstructor');
$subclass_methods = get_class_methods('EmptySubclass');
print count($base_methods); // prints 1
print count($subclass_methods); // prints 1 (PHP4) or 2 (PHP5)
?>