note 112616 deleted from function.create-function by kalle
| From: | kalle@php.net | Date: | Mon, 30 Mar 2015 04:45:30 +0000 |
| Subject: | note 112616 deleted from function.create-function by kalle | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-202074@lists.php.net to get a copy of this message | ||
Note Submitter: CertaiN
----
Wrapper for create_function, avoiding memory leaks.
This is mainly for older than PHP 5.3 .
<?php
function create_lambda($args, $code) {
static $list = array();
$hash = md5("{$args}\0{$code}");
if (!isset($list[$hash])) {
$list[$hash] = create_function($args, $code);
}
return $list[$hash];
}