1--TEST-- 2Test array_sum() function : usage variations - array with different float values 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 * sum of array containing different float values 12*/ 13 14echo "*** Testing array_sum() : array with different float values ***\n"; 15 16// Simple float array 17$float_input = array( 1.1, 2.3, 0.0, 0.5, -2.3, -0.8, .5); 18echo "-- simple float array --\n"; 19var_dump( array_sum($float_input) ); 20 21// float array with scientific notations 22$float_input = array( 1.2e2, 23.4e3, -4.1e2, 0.2e2, 2.1e-2, .5e3); 23echo "-- float array with scientific notations e and E --\n"; 24var_dump( array_sum($float_input) ); 25$float_input = array( 1.2E2, 23.4E3, -4.1E2, 0.2E2, 2.1E-2, .5E3); 26var_dump( array_sum($float_input) ); 27 28// Mixed float array 29$float_input = array( 30 1.2, 31 0.5 32 -5.8, 33 6.334, 34 -0.65, 35 1.2e3, 36 -2.3e2, 37 5.56E3, 38 -3.82E-2 39); 40echo "-- Mixed float array --\n"; 41var_dump( array_sum($float_input) ); 42 43echo "Done" 44?> 45--EXPECT-- 46*** Testing array_sum() : array with different float values *** 47-- simple float array -- 48float(1.3) 49-- float array with scientific notations e and E -- 50float(23630.021) 51float(23630.021) 52-- Mixed float array -- 53float(6531.5458) 54Done 55