The array_sum () function that sums the php array values. This tutorial briefly describes how to use the array_sum () function and the statistical array of numeric data in php. Example 1 code is as follows? Php $ aarray (0 This tutorial briefly describes the usage of the array_sum () function and the number type data in the statistical array in php.
Example 1
The code is as follows:
| The code is as follows: |
|
|
$ A = array (0 => "5", 1 => "15", 2 => "25 ");
Echo array_sum ($ );
?>
Output:
45 |
Example 2
The code is as follows:
| The code is as follows: |
|
|
$ A = array (0 => 5, 1 => 15, 2 => 25 );
Echo array_sum ($ );
?>
Output:
45 |
Example 3
The code is as follows:
| The code is as follows: |
|
|
$ A = array (0 => 5, 1 => 15.5, 2 => 25 );
Echo array_sum ($ );
?>
Output:
45.5 |
Example 4
The code is as follows:
| The code is as follows: |
|
|
$ A = array (0 => 5, 1 => "15 s", 2 => 25 );
Echo array_sum ($ );
?>
Output:
45 |
Example 5
The code is as follows:
| The code is as follows: |
|
|
$ A = array (0 => 5, 1 => "s15s", 2 => 25 );
Echo array_sum ($ );
?>
Output:
30 |
Explain () usage. Example 1 code is as follows? Php $ a = array (0 =...