note 102656 deleted from functions.anonymous by danbrown
[email protected] Sun, 27 Feb 2011 08:23:43 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
Note Submitter: floydian at phphorizons dot com
----
In regards to: Anonymous 03-Aug-2009 09:50
That test can fail. See code below:
<?php
class anon_test {
public function __invoke($args) {
}
}
$anon_test = new anon_test();
var_dump(is_callable($anon_test) && is_object($anon_test)); // bool(true)
var_dump($anon_test instanceof Closure); // bool(false)
?>
It seems that the only way to truly know if a variable contains an anonymous function is to use the "implementation detail" that we are warned not to rely on.
Cheers