The problem I have is that it does not add the values of several arrays contained in an array, I do not know why, here is the code:
<?php
function solution($number) {
for ($i = 0; $i < $number; $i++) {
$multiplo = $i * $number;
$arreglo = [];
$arreglo[$i] = str_split($multiplo);
print_r(array_sum(array_column($arreglo, '0')));
}
}
solution('3');
?>
This is the way to add the elements of the array as you fill it in your for, to the left of equals the elements of the array and to the right their sum. To do this you must start the array where you are going to store the numbers to add outside the loop, and the addition is done after the loop, which is when you have already filled the array. If you start the array inside the loop it will have a single element in each cycle, and the sum of an element is that element, hence the result you had.
I hope that with this you can already advance in your exercise.