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