Return to array_sum_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test array_sum() function : error conditions 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: echo "*** Testing array_sum() : error conditions ***\n"; 11: 12: // Zero arguments 13: echo "-- Testing array_sum() function with zero arguments --\n"; 14: var_dump( array_sum() ); 15: 16: // One more than the expected number of arguments 17: echo "-- Testing array_sum() function with more than expected no. of arguments --\n"; 18: $input = array(1, 2, 3, 4); 19: $extra_arg = 10; 20: var_dump( array_sum($input, $extra_arg) ); 21: 22: echo "Done" 23: ?> 24: --EXPECTF-- 25: *** Testing array_sum() : error conditions *** 26: -- Testing array_sum() function with zero arguments -- 27: 28: Warning: array_sum() expects exactly 1 parameter, 0 given in %s on line %d 29: NULL 30: -- Testing array_sum() function with more than expected no. of arguments -- 31: 32: Warning: array_sum() expects exactly 1 parameter, 2 given in %s on line %d 33: NULL 34: Done