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--EXPECTF--
31*** Testing each() : usage variations ***
32
33-- Current position: --
340 => zero
35
36-- Call to each(): --
37
38Deprecated: The each() function is deprecated. This message will be suppressed on further calls in %s on line %d
39array(4) {
40  [1]=>
41  string(4) "zero"
42  ["value"]=>
43  string(4) "zero"
44  [0]=>
45  int(0)
46  ["key"]=>
47  int(0)
48}
49
50-- New position: --
511 => one
52Done
53