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