note 103929 added to function.method-exists
| From: | Niels at osu1 dot php dot net | Date: | Wed, 11 May 2011 19:45:50 +0000 |
| Subject: | note 103929 added to function.method-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179644@lists.php.net to get a copy of this message | ||
Just to mention it: both method_exists() and is_callable() return true for inherited methods:
<?php
class ParentClass {
function doParent() { }
}
class ChildClass extends ParentClass { }
$p = new ParentClass();
$c = new ChildClass();
// all return true
var_dump(method_exists($p, 'doParent'));
var_dump(method_exists($c, 'doParent'));
var_dump(is_callable(array($p, 'doParent')));
var_dump(is_callable(array($c, 'doParent')));
?>
----
Server IP: 212.124.37.9
Probable Submitter: 91.42.190.80
----
Manual Page -- http://www.php.net/manual/en/function.method-exists.php
Edit -- https://master.php.net/note/edit/103929
Del: integrated -- https://master.php.net/note/delete/103929/integrated
Del: useless -- https://master.php.net/note/delete/103929/useless
Del: bad code -- https://master.php.net/note/delete/103929/bad+code
Del: spam -- https://master.php.net/note/delete/103929/spam
Del: non-english -- https://master.php.net/note/delete/103929/non-english
Del: in docs -- https://master.php.net/note/delete/103929/in+docs
Del: other reasons-- https://master.php.net/note/delete/103929
Reject -- https://master.php.net/note/reject/103929
Search -- https://master.php.net/manage/user-notes.php