diff options
author | Urban Müller | 2008-06-20 19:14:52 +0000 |
---|---|---|
committer | Urban Müller | 2008-06-20 19:14:52 +0000 |
commit | 5a680aa8325deb278f97dcb24548b0802c5fdb7f (patch) | |
tree | e226d8a8e6b3bb8022b6e5a12bb4d82592364bc6 /it.class | |
parent | 49e067914373fbafe98c71f5dbb6c807b6e27476 (diff) | |
download | itools-5a680aa8325deb278f97dcb24548b0802c5fdb7f.tar.gz itools-5a680aa8325deb278f97dcb24548b0802c5fdb7f.tar.bz2 itools-5a680aa8325deb278f97dcb24548b0802c5fdb7f.zip |
it::map for array iteration
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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; +} + } ?> |