note 101507 modified in function.method-exists by danbrown
| From: | danbrown@php.net | Date: | Tue, 21 Dec 2010 17:17:10 +0000 |
| Subject: | note 101507 modified in function.method-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175110@lists.php.net to get a copy of this message | ||
As noted [elsewhere] method_exists() does not care about the existence of __call(), whereas
is_callable() does:
<?php
class Test {
public function explicit( ) {
// ...
}
public function __call( $meth, $args ) {
// ...
}
}
$Tester = new Test();
var_export(method_exists($Tester, 'anything')); // false
var_export(is_callable(array($Tester, 'anything'))); // true
?>
--was--
As noted at http://php.net/is-callable#100237
method_exists() does not care about the existence of __call(), whereas is_callable() does:
<?php
class Test {
public function explicit( ) {
// ...
}
public function __call( $meth, $args ) {
// ...
}
}
$Tester = new Test();
var_export(method_exists($Tester, 'anything')); // false
var_export(is_callable(array($Tester, 'anything'))); // true
http://php.net/manual/en/function.method-exists.php