note 71700 added to function.get-class-methods
| From: | robert dot hunter at m3 dot net | Date: | Tue, 12 Dec 2006 13:48:58 +0000 |
| Subject: | note 71700 added to function.get-class-methods | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120549@lists.php.net to get a copy of this message | ||
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)
?>
----
Server IP: 85.116.0.130
Probable Submitter: 84.12.130.35
----
Manual Page -- http://www.php.net/manual/en/function.get-class-methods.php
Edit -- https://master.php.net/note/edit/71700
Del: integrated -- https://master.php.net/note/delete/71700/integrated
Del: useless -- https://master.php.net/note/delete/71700/useless
Del: bad code -- https://master.php.net/note/delete/71700/bad+code
Del: spam -- https://master.php.net/note/delete/71700/spam
Del: non-english -- https://master.php.net/note/delete/71700/non-english
Del: in docs -- https://master.php.net/note/delete/71700/in+docs
Del: other reasons-- https://master.php.net/note/delete/71700
Reject -- https://master.php.net/note/reject/71700
Search -- https://master.php.net/manage/user-notes.php