summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2008-06-20 19:14:52 +0000
committerUrban Müller2008-06-20 19:14:52 +0000
commit5a680aa8325deb278f97dcb24548b0802c5fdb7f (patch)
treee226d8a8e6b3bb8022b6e5a12bb4d82592364bc6 /it.class
parent49e067914373fbafe98c71f5dbb6c807b6e27476 (diff)
downloaditools-5a680aa8325deb278f97dcb24548b0802c5fdb7f.tar.gz
itools-5a680aa8325deb278f97dcb24548b0802c5fdb7f.tar.bz2
itools-5a680aa8325deb278f97dcb24548b0802c5fdb7f.zip
it::map for array iteration
Diffstat (limited to 'it.class')
-rw-r--r--it.class11
1 files changed, 11 insertions, 0 deletions
diff --git a/it.class b/it.class
index 9383d8e..aa12435 100644
--- a/it.class
+++ b/it.class
@@ -642,6 +642,17 @@ function date($format = "", $stamp = null)
return date($formatstring, $stamp);
}
+
+function map($expr, $arr)
+{
+ $func = create_function('$k,$v', "return $expr;");
+
+ foreach ($arr as $k => $v)
+ $result[$k] = $func($k, $v);
+
+ return (array)$result;
+}
+
}
?>