From 5a680aa8325deb278f97dcb24548b0802c5fdb7f Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 20 Jun 2008 19:14:52 +0000 Subject: it::map for array iteration --- it.class | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'it.class') 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; +} + } ?> -- cgit v1.2.3