My question is about how to add the values from two different arrays, that each have 20 records.
$array1
Array
(
    [0] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] => 
            [num_rows] => 220
            [type] => 0
        )
    [1] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] => 
            [num_rows] => 70
            [type] => 0
        )
$array2
Array
(
    [0] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] => 
            [num_rows] => 280
            [type] => 0
        )
[1] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] => 
            [num_rows] => 30
            [type] => 0
        )
I would like to get a third array like that (adding the values of $array1 and $array2):
Array
(
    [0] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] => 
            [num_rows] => 500
            [type] => 0
        )
[1] => mysqli_result Object
        (
            [current_field] => 0
            [field_count] => 1
            [lengths] => 
            [num_rows] => 100
            [type] => 0
        )
How do I do this? All operations I've tried only added the values one after another (new array with 40 rows), not adding them.
EDIT SOLUTION
$array3 = array();
for ($i = 0; $i < count($array2); $i++) {
array_push($array3, $array1[$i]->num_rows + $array2[$i]->num_rows); 
}
 
     
     
    