PHPize Online / SQLize Online

Popular

array_sum

Tags: PHP 5.x PHP 7.x PHP 8.x

array_sum — Calculate the sum of values in an array.

Description

array_sum(
    array $array
): int|float
array_sum() returns the sum of values in an array.

Parameters

array
The input array.

Return Values

Returns the sum of values as an integer or float; 0 if the array is empty.