]> _ Git - cubist_util.git/commitdiff
wip #3753
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Nov 2020 20:09:36 +0000 (21:09 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 25 Nov 2020 20:09:36 +0000 (21:09 +0100)
src/Cubist/Util/ArrayUtil.php

index 78561232174533c8237dbb8489a7b75991610cd6..aef58b463d7f19a3ea7c94c4e23eecb323b8a193 100644 (file)
@@ -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)) {