📜 ⬆️ ⬇️

PHP closures and passing arguments by reference

For the sake of interest, I decided to make a mechanism for closures in PHP. I know that in PHP 5.3 there is such a mechanism, so I emphasize - purely from academic interest. And my curiosity gave (at least for me - someone could already deal with this) its fruits - in addition to the closures proper, I received an interesting method of passing arguments.

The closure mechanism consists of the following class:

class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  1. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  2. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  3. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  4. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  5. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  6. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  7. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  8. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  9. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  10. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  11. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  12. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  13. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  14. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  15. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  16. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  17. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  18. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  19. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  20. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  21. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  22. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  23. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  24. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  25. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  26. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  27. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  28. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  29. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  30. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  31. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  32. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  33. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  34. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  35. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  36. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  37. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  38. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  39. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  40. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  41. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  42. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  43. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  44. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  45. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  46. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  47. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  48. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  49. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  50. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  51. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  52. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  53. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  54. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  55. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  56. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  57. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  58. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  59. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  60. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
  61. class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .
class closure { private static $l_closures = array(); public static function create($_scope, $_args, $_code) { $id = md5( "closure::create>" .serialize($_scope).$_args.$_code); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $header_code = '$scope=closure::scope("' .$id. '");' ; $header_end = 'unset($scope);' ; if ($_scope) { foreach ($_scope as $key => $value) { if ($key == 'scope' ) { $header_end = '$' .$key. '=&$scope["' .$key. '"];' ; } else { $header_code .= '$' .$key. '=&$scope["' .$key. '"];' ; } } } $header_code .= $header_end; $closure = array( "function" => create_function($_args, $header_code.$_code), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function bind($_scope, $_function) { $id = md5( "closure::bind>" .serialize($_scope).$_function); if (isset(self::$l_closures[$id])) { print "exists<br>" ; return self::$l_closures[$id][ "function" ]; } print "create new<br>" ; $closure = array( "function" => create_function( '' , '$scope=closure::scope("' .$id. '");$debug=debug_backtrace();$args=$debug[0]["args"];call_user_func_array("' .$_function. '", array_merge($scope,$args));' ), "scope" => is_array($_scope) ? $_scope : array() ); self::$l_closures[$id] = $closure; return $closure[ "function" ]; } public static function scope($_id) { if (isset(self::$l_closures[$_id])) { return self::$l_closures[$_id][ "scope" ]; } return array(); } } * This source code was highlighted with Source Code Highlighter .

')
and nothing more. This is how it looks in action:

  1. function outer1 ($ _ arg)
  2. {
  3. $ local_var = 70;
  4. return closure :: create (
  5. / * scope * / array ( '_arg' => & $ _ arg, 'local_var' => & $ local_var),
  6. / * args * / '& $ _ inner_arg' ,
  7. / * code * / 'print $ _arg. "". $ local_var. "". $ _ inner_arg; $ _arg = 110; $ _inner_arg = 120; '
  8. );
  9. }
  10. $ a = 50;
  11. $ inner1 = outer1 (& $ a);
  12. $ inner1 = outer1 (& $ a);
  13. $ inner1 = outer1 (& $ a);
  14. $ ia = 90;
  15. $ inner1 (& $ ia);
  16. print "" . $ a. "" . $ ia. "<br>" ;
  17. function inner2 ($ _ arg, $ local_var, & $ _ inner_arg)
  18. {
  19. print $ _arg. "" . $ local_var. "" . $ _ inner_arg; $ _arg = 110; $ _inner_arg = 120;
  20. }
  21. function outer2 ($ _ arg)
  22. {
  23. $ local_var = 70;
  24. return closure :: bind (
  25. / * scope * / array (& $ _ arg, & $ local_var),
  26. / * function * / 'inner2'
  27. );
  28. }
  29. $ a = 50;
  30. $ inner2 = outer2 (& $ a);
  31. $ inner2 = outer2 (& $ a);
  32. $ inner2 = outer2 (& $ a);
  33. $ ia = 90;
  34. $ inner2 (& $ ia);
  35. print "" . $ a. "" . $ ia. "<br>" ;
* This source code was highlighted with Source Code Highlighter .


The closure :: create method looks the same as create_function - only at the beginning it passes another parameter, the environment in the form of an associative array, the keys of which are the names of the variables (without the $ sign), and the values ​​correspond to their values.

closure :: bind takes an environment as an array with the values ​​of variables and a function that will be closed for caching. The function must accept environment variables at the beginning, and only then the arguments with which it will be called.

print "create new"; and print "exists"; introduced to show that each closure is created only once.

As long as PHP 5.3 has not settled tightly on all hosting sites, you can use this mechanism.

Now pay attention to lines 37-39. For clarity, I will write a separate example:

  1. function f ()
  2. {
  3. $ args = func_get_args ();
  4. $ args [0] = 10;
  5. }
  6. $ a = 20;
  7. f (& $ a);
  8. print $ a. "<br>" ;
  9. $ a = 20;
  10. call_user_func_array ( 'f' , array (& $ a));
  11. print $ a. "<br>" ;
* This source code was highlighted with Source Code Highlighter .


At the output of the f function, the value of the $ a variable will be, as it was, 20 - the func_get_args function returns not an array of arguments, but an array of argument values , i.e. the link disappeared and we changed the local variable.

Now consider this example:

  1. function f ()
  2. {
  3. $ debug = debug_backtrace ();
  4. $ debug [0] [ "args" ] [0] = 10;
  5. }
  6. $ a = 20;
  7. f (& $ a);
  8. print $ a. "<br>" ;
  9. $ a = 20;
  10. call_user_func_array ( 'f' , array (& $ a));
  11. print $ a. "<br>" ;
* This source code was highlighted with Source Code Highlighter .


An example will display 10, i.e. what we expected! It is the arguments themselves that are stored in debug_backtrace. call_user_func_array can transfer values ​​by reference, so

  1. call_user_func_array ( 'f' , array (& $ a));
* This source code was highlighted with Source Code Highlighter .


will also write the value 10 in $ a.

I fully admit that for someone it would be a warrior, but, taking into account the fact that I did not know this before and could not find anything on the Internet, it may be useful to others, so don’t be too strict.

Thank you for attention!

UPD # 1 12/05/09

The scope method of the closure class needs to be changed as follows:

  1. public static function scope ($ _ id)
  2. {
  3. $ result = array ();
  4. if (isset (self :: $ l_closures [$ _ id]))
  5. {
  6. if (self :: $ l_closures [$ _ id] [ "scope" ])
  7. {
  8. foreach (self :: $ l_closures [$ _ id] [ "scope" ] as $ key => $ value)
  9. {
  10. $ result [$ key] = & self :: $ l_closures [$ _ id] [ "scope" ] [$ key];
  11. }
  12. }
  13. }
  14. return $ result;
  15. }
* This source code was highlighted with Source Code Highlighter .


When a reference to a variable remains unique, PHP for some reason converts it into the value itself, i.e. local variables will already be transferred from the environment not by reference, but by value, which is useless. With the same modification example

  1. function inner2 ($ _ arg, $ local_var, & $ _ inner_arg)
  2. {
  3. $ local_var ++;
  4. print $ _arg. "" . $ local_var. "" . $ _ inner_arg; $ _arg = 110; $ _inner_arg = 120;
  5. }
  6. function outer2 ($ _ arg)
  7. {
  8. $ local_var = 70;
  9. return closure :: bind (
  10. / * scope * / array (& $ _ arg, & $ local_var),
  11. / * function * / 'inner2'
  12. );
  13. }
  14. $ a = 50;
  15. $ inner2 = outer2 (& $ a);
  16. $ inner2 = outer2 (& $ a);
  17. $ inner2 = outer2 (& $ a);
  18. $ ia = 90;
  19. $ inner2 (& $ ia);
  20. print "" . $ a. "" . $ ia. "<br>" ;
  21. $ inner2 (& $ ia);
  22. print "" . $ a. "" . $ ia. "<br>" ;
* This source code was highlighted with Source Code Highlighter .


would print 71 and 72 for $ local_var, respectively, whereas without the specified method change, he would output 71 in both cases.

UPD # 2 12/05/09

In point 49 of the class you need to write return call_user_func_array.

Source: https://habr.com/ru/post/77282/


All Articles