1--TEST--
2Test end() function : usage variations - Referenced variables
3--FILE--
4<?php
5/* Prototype  : mixed end(array $array_arg)
6 * Description: Advances array argument's internal pointer to the last element and return it
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 end() : usage variations ***\n";
15
16$array1 = array ('zero', 'one', 'two');
17
18echo "\n-- Initial position of internal pointer --\n";
19var_dump(current($array1));
20end($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;
25echo "\n-- Position after calling end() --\n";
26echo "\$array1: ";
27var_dump(current($array1));
28echo "\$array2: ";
29var_dump(current($array2));
30?>
31===DONE===
32--EXPECT--
33*** Testing end() : usage variations ***
34
35-- Initial position of internal pointer --
36string(4) "zero"
37
38-- Position after calling end() --
39$array1: string(3) "two"
40$array2: string(3) "two"
41===DONE===
42