is_callable & Bug 20216
| From: | Leon Atkinson | Date: | Mon, 18 Nov 2002 16:39:30 +0000 |
| Subject: | is_callable & Bug 20216 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-91290@lists.php.net to get a copy of this message | ||
Can someone shed some light on is_callable? I think I understand it's meant
for testing whether a function or method is callable, but it would be nice
to get some confirmation from someone who knows for sure. Philip and I are
trying to add this function to the manual.
Here are some rough notes I have on my understanding of the function (from
http://bugs.php.net/bug.php?id=20216):
This function wraps zend_is_callable. The first argument is the name
of a function or method. Class and object methods are specified by
passing an array with two elements: class or object and method name.
The second argument seems to be for checking syntax only, but I can't
figure out how to make is_callable return FALSE when the second
argument is TRUE.
The third argument receives the "callable name". In the example below
it's "a::b". Note, however, that despite the implication that a::b()
is a callable static method, this is not the case.
<?
class a
{
var $c;
function b()
{
return($this->c);
}
}
$d = new a;
if(is_callable(array($d, 'b'), FALSE, $name))
{
print($name);
}
?>
Thanks!
---
Leon Atkinson <http://www.leonatkinson.com/>