Verification: a143cc29221c9be0

Php array sum by key

Array with string and number as elements

Here is the code.

";
?>
Sum of values = 30

Sum with keys

$input=array('One' =>1,'Two'=>2,'Three'=>3,'Fourth');
echo array_sum($input); // Output is 6
6