summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorChristian Schneider2008-07-24 13:25:20 +0000
committerChristian Schneider2008-07-24 13:25:20 +0000
commit11fe0b47f21730e2f955ae63896bce2962af1829 (patch)
tree6a8004a2a1e79db2bedcfaa8e95f50b14322b821 /it.class
parent0b486afe33e43c9f0eee690b63753683930fe1c0 (diff)
downloaditools-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.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);