ID: 50037 Updated by: [email protected] Reported By: mjs at beebo dot org -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: OS X PHP Version: 5.3.0 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Use is_callable() Previous Comments: ------------------------------------------------------------------------ [2009-10-29 21:24:42] mjs at beebo dot org Description: ------------ There doesn't seem to be any good way to check whether a variable is a closure/anonymous function. If $fn = function() { }; gettype($fn) is "object", and there is no is_function() or equivalent. The only way seems to be gettype($fn) == "object" && get_class($fn) == "Closure" but the anonymous function documentation says that the fact that anonymous functions have class Closure "is an implementation detail and should not be relied upon." I suggest: 1. gettype() returns "function" or "closure" when passed a closure. 2. is_function() is created that returns true when passed a closure, otherwise false. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50037&edit=1
