note 103068 deleted from function.get-defined-functions by danbrown
| From: | danbrown@php.net | Date: | Wed, 23 Mar 2011 17:55:00 +0000 |
| Subject: | note 103068 deleted from function.get-defined-functions by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178139@lists.php.net to get a copy of this message | ||
Note Submitter: sfinktah at php dot spamtrak dot org
----
Not sure what Chaos was trying to achieve, but if you wanted a more granular version of
function_exists(), this would be an improvement:
/**
* @param $function_name Name of the function
* @param $group Context (internal | user)
*
* @return TRUE if function exists
*/
function better_user_func_exists($function_name = "my_function", $group =
"internal") {
return in_array($function_name,
($group == "internal")
? array_shift(get_defined_functions())
: array_pop(get_defined_functions())
);
}