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);

dump($flatten1$flatten2);
Result
^ array:7 [
0 => 1
1 => 2
2 => 3
3 => 4
4 => 5
5 => 6
6 => 7
]

^ array:5 [
0 => 1
1 => 2
2 => 3
3 => 4
4 => 5
]
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8