1--TEST--
2Test key() function : usage variations
3--FILE--
4<?php
5/* Prototype  : mixed key(array $array_arg)
6 * Description: Return the key of the element currently pointed to by the internal array pointer
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Test how the internal pointer is affected when two variables are referenced to each other
12 */
13
14echo "*** Testing key() : usage variations ***\n";
15
16$array1 = array ('zero', 'one', 'two');
17
18echo "\n-- Initial position of internal pointer --\n";
19var_dump(key($array1));
20
21// Test that when two variables are referenced to one another
22// the internal pointer is the same for both
23$array2 = &$array1;
24
25next($array1);
26
27echo "\n-- Position after calling next() --\n";
28echo "\$array1: ";
29var_dump(key($array1));
30echo "\$array2: ";
31var_dump(key($array2));
32?>
33===DONE===
34--EXPECT--
35*** Testing key() : usage variations ***
36
37-- Initial position of internal pointer --
38int(0)
39
40-- Position after calling next() --
41$array1: int(1)
42$array2: int(1)
43===DONE===
44