summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class5
1 files changed, 4 insertions, 1 deletions
diff --git a/it.class b/it.class
index addcf64..ab56894 100644
--- a/it.class
+++ b/it.class
@@ -650,7 +650,10 @@ function date($format = "", $stamp = null)
*/
function map($expression, $array)
{
- $func = create_function('$k,$v', "return $expression;");
+ static $cache = array();
+
+ if (!($func = $cache[$expression]))
+ $func = $cache[$expression] = create_function('$k,$v', "return $expression;");
foreach ($array as $k => $v)
$result[$k] = $func($k, $v);