From: Vincent Vanwaelscappel Date: Wed, 25 Nov 2020 20:09:36 +0000 (+0100) Subject: wip #3753 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9a5716478a1400bbfa1874686550648fc08066e7;p=cubist_util.git wip #3753 --- diff --git a/src/Cubist/Util/ArrayUtil.php b/src/Cubist/Util/ArrayUtil.php index 7856123..aef58b4 100644 --- a/src/Cubist/Util/ArrayUtil.php +++ b/src/Cubist/Util/ArrayUtil.php @@ -10,6 +10,19 @@ class ArrayUtil { unset($input[$key]); } + public static function flatten($a) + { + $res = array(); + foreach($a as $k => $v) { + if (is_array($v)) { + $res = array_merge($res, self::flatten($v)); + } else { + $res[$k] = $v; + } + } + return $res; + } + public static function removeValues(&$input, $values, $strict = false) { if (!is_array($values)) {