xxxxxxxxxx
<?php
function add($numbers){
$ttl=0;
foreach ($numbers as $num){
$ttl=$ttl+$num;
}
return $ttl;
}
$total=add(10,15,20);
echo "total= $total\n";
echo "total=". add(1,2,3,4,5). "\n";
?>
xxxxxxxxxx
<?php
function add($numbers){
$ttl=0;
foreach ($numbers as $num){
$ttl=$ttl+$num;
}
return $ttl;
}
$total=add(10,15,20);
echo "total= $total\n";
echo "total=". add(1,2,3,4,5). "\n";
?>