1--TEST--
2foreach with reference
3--FILE--
4<?php
5
6$array = ['a', 'b', 'c', 'd'];
7
8foreach ($array as &$a) {
9}
10
11var_dump($array);
12
13var_dump(array_values($array));
14var_dump($a);
15
16var_dump(array_reverse($array));
17
18?>
19--EXPECT--
20array(4) {
21  [0]=>
22  string(1) "a"
23  [1]=>
24  string(1) "b"
25  [2]=>
26  string(1) "c"
27  [3]=>
28  &string(1) "d"
29}
30array(4) {
31  [0]=>
32  string(1) "a"
33  [1]=>
34  string(1) "b"
35  [2]=>
36  string(1) "c"
37  [3]=>
38  &string(1) "d"
39}
40string(1) "d"
41array(4) {
42  [0]=>
43  &string(1) "d"
44  [1]=>
45  string(1) "c"
46  [2]=>
47  string(1) "b"
48  [3]=>
49  string(1) "a"
50}
51