diff --git a/src/Illuminate/Support/Arr.php b/src/Illuminate/Support/Arr.php index 0f0b6fcf8e9a..31824b60c949 100755 --- a/src/Illuminate/Support/Arr.php +++ b/src/Illuminate/Support/Arr.php @@ -213,10 +213,14 @@ public static function flatten($array, $depth = INF) if (! is_array($item)) { $result[] = $item; - } elseif ($depth === 1) { - $result = array_merge($result, array_values($item)); } else { - $result = array_merge($result, static::flatten($item, $depth - 1)); + $values = $depth === 1 + ? array_values($item) + : static::flatten($item, $depth - 1); + + foreach ($values as $value) { + $result[] = $value; + } } }