The array_sum() function returns the sum of all the values in the array
Syntaxarray_sum(array)
Example
<?php // sum the all the values in the array $sum=array(0=>15,1=>15,1=>15,); echo array_sum($sum); ?> |
45
>
The array_sum() function returns the sum of all the values in the array
Syntax<?php // sum the all the values in the array $sum=array(0=>15,1=>15,1=>15,); echo array_sum($sum); ?> |
$ages['Peter'] = "32"; $ages['Quagmire'] = "30"; $ages['Joe'] = "34"; |
| < ?php $ages['Peter'] = "32"; $ages['Quagmire'] = "30"; $ages['Joe'] = "34"; echo "Peter is " . $ages['Peter'] . " years old."; ?> |