From 9a5716478a1400bbfa1874686550648fc08066e7 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 25 Nov 2020 21:09:36 +0100 Subject: [PATCH] wip #3753 --- src/Cubist/Util/ArrayUtil.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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)) { -- 2.39.5