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