Arbitrary Arrays in PHP
Multidimensional arrays do not necessarily have to be like the ones we considered above. Take a look, for example, at the following array:
<?php
$arr = [['a', 'b', [1, 2, 3], [4, 5]], ['d', ['e', 'f']]];
?>
If we rewrite it in a more understandable form, we will see that this array is "irregular". In it, arrays are located next to ordinary elements:
<?php
$arr = [
[
'a', 'b', [1, 2, 3], [4, 5],
],
[
'd', ['e', 'f'],
],
];
?>
Given the following array:
<?php
$arr = [[1, 2, 3, [4, 5, [6, 7]]], [8, [9, 10]]];
?>
Find the sum of all elements of the given array. Access each element individually, without a loop.