Here I’m going to discuss about, how to add the table row values using php. This concept is very simple one, and used in organization for accounting purpose or total mark or value related operations.Here the values are declared as array in php, two variables like $a and $b are used for this operation.This same operations can performe mysql with php also.
<?php
$a=array(5,15,25);
$b=array(100,200,300);
echo array_sum($a);
echo array_sum($b);
?>
The $a=array(5,15,25) and $b=array(100,200,300); used for stores multiple values in one single variable, $a contain 5,15,25 and $b stores 100,200,300.
array_sum() function return the sum of all the values in the array.
FULL CODE
Sl No | Maths Mark | English Mark |
---|---|---|
1 | ||
2 | ||
3 | ||
Sum |
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.