diff options
author | Christian Schneider | 2008-07-24 13:25:20 +0000 |
---|---|---|
committer | Christian Schneider | 2008-07-24 13:25:20 +0000 |
commit | 11fe0b47f21730e2f955ae63896bce2962af1829 (patch) | |
tree | 6a8004a2a1e79db2bedcfaa8e95f50b14322b821 /it.class | |
parent | 0b486afe33e43c9f0eee690b63753683930fe1c0 (diff) | |
download | itools-11fe0b47f21730e2f955ae63896bce2962af1829.tar.gz itools-11fe0b47f21730e2f955ae63896bce2962af1829.tar.bz2 itools-11fe0b47f21730e2f955ae63896bce2962af1829.zip |
Only create function for same expression once
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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); |