Supporting Laravel class for Arrays: flatten an multidimensional array

Code
<?php

use Illuminate\Support\Arr;

$array1 = [
    
12,
    [
34],
    [
5],
    
67,
];

$array2 = [
    
'one' => 1,
    
'two' => 2,
    [
        
'one' => 3,
        
'four' => 4,
    ],
    
'five' => 5,
];

$flatten1 Arr::flatten($array1);
$flatten2 Arr::flatten($array2);

var_dump($flatten1$flatten2);
Result
array(7) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
[5]=>
int(6)
[6]=>
int(7)
}
array(5) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
[3]=>
int(4)
[4]=>
int(5)
}
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6