From 9e7450f97770471d98599dd3a89490156fd30d2f Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 1 Mar 2018 04:17:15 +0900 Subject: [PATCH] =?UTF-8?q?array=5Fmap=EC=9D=98=20=EB=B3=B4=EC=99=84?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20dict=5Fmap=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80.=20python=EC=9D=98=20map=EA=B3=BC=20=EC=9C=A0?= =?UTF-8?q?=EC=82=AC=ED=95=98=EA=B2=8C=20=EB=8F=99=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/twe/lib.php b/twe/lib.php index a3862b3f..ce698fb0 100644 --- a/twe/lib.php +++ b/twe/lib.php @@ -252,6 +252,14 @@ function LogText($prefix, $variable){ fclose($fp); } +function dict_map($callback, $dict){ + $result = []; + foreach(array_keys($dict) as $key){ + $result[$key] = ($callback)($dict[$key]); + } + return $result; +} + function ArrayToDict($arr, $keyName){ $result = [];