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/>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to