addition in array php code example
Example 1: php sum array elements
<?php
$a=array(5,15,25);
echo array_sum($a);
?>
Example 2: addition in php
<?php
$x=15;
$y=30;
$z=$x+$y;
echo "Sum: ",$z;
?>
<?php
$a=array(5,15,25);
echo array_sum($a);
?>
<?php
$x=15;
$y=30;
$z=$x+$y;
echo "Sum: ",$z;
?>