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
30--EXPECTF--
31*** Testing each() : error conditions ***
32
33-- Testing each() function with Zero arguments --
34
35Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
36NULL
37
38-- Testing each() function with more than expected no. of arguments --
39
40Warning: each() expects exactly 1 parameter, 2 given in %s on line %d
41NULL
42Done
43
44