Conditions | 6 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public static function merge(array $arrays) |
||
19 | { |
||
20 | $result = []; |
||
21 | foreach ($arrays as $array) { |
||
22 | foreach ($array as $key => $value) { |
||
23 | if (is_int($key)) { |
||
24 | $result[] = $value; |
||
25 | continue; |
||
26 | } |
||
27 | |||
28 | if (isset($result[$key]) && is_array($result[$key])) { |
||
29 | $result[$key] = self::merge( |
||
30 | [$result[$key], $value] |
||
31 | ); |
||
32 | continue; |
||
33 | } |
||
34 | |||
35 | $result[$key] = $value; |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return $result; |
||
40 | } |
||
42 |