1--TEST-- 2Test each() function : error conditions - pass incorrect number of args 3--FILE-- 4<?php 5/* Prototype : array each(array $arr) 6 * Description: Return the currently pointed key..value pair in the passed array, 7 * and advance the pointer to the next element 8 * Source code: Zend/zend_builtin_functions.c 9 */ 10 11/* 12 * Pass an incorrect number of arguments to each() to test behaviour 13 */ 14 15echo "*** Testing each() : error conditions ***\n"; 16 17// Zero arguments 18echo "\n-- Testing each() function with Zero arguments --\n"; 19var_dump( each() ); 20 21//Test each with one more than the expected number of arguments 22echo "\n-- Testing each() function with more than expected no. of arguments --\n"; 23$arr = array(1, 2); 24$extra_arg = 10; 25var_dump( each($arr, $extra_arg) ); 26 27echo "Done"; 28?> 29--EXPECTF-- 30*** Testing each() : error conditions *** 31 32-- Testing each() function with Zero arguments -- 33 34Warning: each() expects exactly 1 parameter, 0 given in %s on line %d 35NULL 36 37-- Testing each() function with more than expected no. of arguments -- 38 39Warning: each() expects exactly 1 parameter, 2 given in %s on line %d 40NULL 41Done 42