xref: /PHP-7.2/Zend/tests/foreach.phpt (revision 17ccbeec)
1--TEST--
2foreach() by-ref bug
3--FILE--
4<?php
5$foo = array(1,2,3,4);
6foreach($foo as $key => &$val) {
7	if($val == 3) {
8		$foo[$key] = 0;
9	} else {
10		$val++;
11	}
12}
13var_dump($foo);
14?>
15--EXPECT--
16array(4) {
17  [0]=>
18  int(2)
19  [1]=>
20  int(3)
21  [2]=>
22  int(0)
23  [3]=>
24  &int(5)
25}
26