There is the following code that fills the matrix with random number and displays its elements:

`<?php $sum_col = 0; for ($i = 1; $i <= 5; $i++) { $sum_row = 0; for ($j = 1; $j <= 7; $j++) { $matrix[$i][$j] = rand(-100, 100); $sum_row = $sum_row + $matrix[$i][$j]; echo $matrix[$i][$j] . ' '; if ($j == 7) echo $sum_row . '</br>'; } } ?>`

The sum of the elements in the rows of the matrix is calculated correctly. I can’t figure out how to calculate and display the sum of the elements in the columns in the last line.