note 99725 deleted from function.create-function by danbrown
| From: | danbrown@php.net | Date: | Wed, 01 Sep 2010 19:37:38 +0000 |
| Subject: | note 99725 deleted from function.create-function by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172256@lists.php.net to get a copy of this message | ||
Note Submitter: Its Will
----
Here's the bug-free version, finally!:
<?
if(!function_exists('ob_lambda_func')){
function ob_lambda_func($method, $args) {
if((phpversion()+0)<5.1 || (substr(phpversion(),2)+0)<1.1)
die("\nError: This script requires PHP v5.1.1+!\n");
$bt=debug_backtrace();
foreach($bt as $xsp) {
if(isset($xsp['object'])) {
if(!method_exists($xsp['object'], $method)) continue;
return call_user_func_array(array($xsp['object'], $method), $args);
}
}
if(!function_exists($method))
die("\nOB: Internal Error! ($method)");
return call_user_func_array($method, $args);
}}
if(!function_exists('ob_lambda')){
function ob_lambda($method) {
return create_function('','$args=func_get_args(); return
ob_lambda_func('.var_export($method, true).',$args);');
}}
?>