xref: /PHP-5.5/ext/spl/tests/array_008.phpt (revision 610c7fbe)
1--TEST--
2SPL: ArrayIterator and foreach reference
3--FILE--
4<?php
5
6$arr = array(0=>0, 1=>1, 2=>2);
7$obj = new ArrayObject($arr);
8
9foreach($obj as $ak=>&$av) {
10	foreach($obj as $bk=>&$bv) {
11		if ($ak==0 && $bk==0) {
12			$bv = "modify";
13		}
14		echo "$ak=>$av - $bk=>$bv\n";
15	}
16}
17
18?>
19===DONE===
20<?php exit(0); ?>
21--EXPECTF--
220=>modify - 0=>modify
230=>modify - 1=>1
240=>modify - 2=>2
251=>1 - 0=>modify
261=>1 - 1=>1
271=>1 - 2=>2
282=>2 - 0=>modify
292=>2 - 1=>1
302=>2 - 2=>2
31===DONE===
32