1--TEST-- 2Test array_sum() function : usage variations - associative array 3--FILE-- 4<?php 5/* Prototype : mixed array_sum(array $input) 6 * Description: Returns the sum of the array entries 7 * Source code: ext/standard/array.c 8*/ 9 10/* 11* Testing array_sum() with associative array as 'input' argument 12*/ 13 14echo "*** Testing array_sum() : with associative array ***\n"; 15 16// array with numeric keys 17$input = array(0 => 1, 1 => 10, 2 => 0, 3 => -2, 4 => 23.56); 18echo "-- with numeric keys --\n"; 19var_dump( array_sum($input) ); 20 21// array with string keys 22$input = array('a' => 20, "b" => 50, 'c' => 0, 'd' => -30, "e" => 100); 23echo "-- with string keys --\n"; 24var_dump( array_sum($input) ); 25echo "Done" 26?> 27--EXPECTF-- 28*** Testing array_sum() : with associative array *** 29-- with numeric keys -- 30float(32.56) 31-- with string keys -- 32int(140) 33Done 34