1--TEST-- 2Test array_reduce() function : error conditions 3--FILE-- 4<?php 5/* Prototype : mixed array_reduce(array input, mixed callback [, int initial]) 6 * Description: Iteratively reduce the array to a single value via the callback. 7 * Source code: ext/standard/array.c 8 * Alias to functions: 9 */ 10 11echo "*** Testing array_reduce() : error conditions ***\n"; 12 13 14//Test array_reduce with one more than the expected number of arguments 15echo "\n-- Testing array_reduce() function with more than expected no. of arguments --\n"; 16$input = array(1, 2); 17$callback = 1; 18$initial = 10; 19$extra_arg = 10; 20var_dump( array_reduce($input, $callback, $initial, $extra_arg) ); 21 22// Testing array_reduce with one less than the expected number of arguments 23echo "\n-- Testing array_reduce() function with less than expected no. of arguments --\n"; 24$input = array(1, 2); 25var_dump( array_reduce($input) ); 26 27?> 28===DONE=== 29--EXPECTF-- 30*** Testing array_reduce() : error conditions *** 31 32-- Testing array_reduce() function with more than expected no. of arguments -- 33 34Warning: array_reduce() expects at most 3 parameters, 4 given in %sarray_reduce_error.php on line %d 35NULL 36 37-- Testing array_reduce() function with less than expected no. of arguments -- 38 39Warning: array_reduce() expects at least 2 parameters, 1 given in %sarray_reduce_error.php on line %d 40NULL 41===DONE=== 42