1--TEST--
2Test reset() function : usage variations - Referenced variables
3--FILE--
4<?php
5/*
6 * Reference two arrays to each other then call reset() to test position of
7 * internal pointer in both arrays
8 */
9
10echo "*** Testing reset() : usage variations ***\n";
11
12$array1 = array ('zero', 'one', 'two');
13
14echo "\n-- Initial position of internal pointer --\n";
15var_dump(current($array1));
16
17// Test that when two variables are referenced to one another
18// the internal pointer is the same for both
19$array2 = &$array1;
20
21next($array1);
22
23echo "\n-- Position after calling next() --\n";
24echo "\$array1: ";
25var_dump(current($array1));
26echo "\$array2: ";
27var_dump(current($array2));
28
29echo "\n-- Position after calling reset() --\n";
30var_dump(reset($array1));
31echo "\$array1: ";
32var_dump(current($array1));
33echo "\$array2: ";
34var_dump(current($array2));
35?>
36--EXPECT--
37*** Testing reset() : usage variations ***
38
39-- Initial position of internal pointer --
40string(4) "zero"
41
42-- Position after calling next() --
43$array1: string(3) "one"
44$array2: string(3) "one"
45
46-- Position after calling reset() --
47string(4) "zero"
48$array1: string(4) "zero"
49$array2: string(4) "zero"
50