Re: is_callable & Bug 20216

From: Date: Mon, 18 Nov 2002 16:51:16 +0000
Subject: Re: is_callable & Bug 20216
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-91291@lists.php.net to get a copy of this message
Since I wrote the function, I can provide some insight. On Mon, 18 Nov 2002, Leon Atkinson wrote: > 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. Right. > 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. Try this: var_dump(is_callable(array(1,2), 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); > } > ?> Well, $name is just supposed to indicate which class/method you were checking. It doesn't tell you whether the method is static or not, because in PHP 4 it doesn't make sense. -Andrei http://www.gravitonic.com/ Politics is for the moment, an equation is for eternity. -- Albert Einstein

« previous php.dev (#91291) next »