1--TEST--
2Test each() function : usage variations - Internal array pointer
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 * Test the position of the internal array pointer after a call to each()
13 */
14
15echo "*** Testing each() : usage variations ***\n";
16
17$arr = array('zero', 'one', 'two', 'abc', 'xyz');
18
19echo "\n-- Current position: --\n";
20echo key($arr) . " => " . current($arr) . "\n";
21
22echo "\n-- Call to each(): --\n";
23var_dump( each($arr) );
24
25echo "\n-- New position: --\n";
26echo key($arr) . " => " . current($arr) . "\n";
27
28echo "Done";
29?>
30
31--EXPECTF--
32*** Testing each() : usage variations ***
33
34-- Current position: --
350 => zero
36
37-- Call to each(): --
38array(4) {
39  [1]=>
40  string(4) "zero"
41  ["value"]=>
42  string(4) "zero"
43  [0]=>
44  int(0)
45  ["key"]=>
46  int(0)
47}
48
49-- New position: --
501 => one
51Done