summaryrefslogtreecommitdiff
path: root/ext/spl/tests/array_008.phpt
blob: e7a618dda5e64844fad2b8996f48ffd2babdcef4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--TEST--
SPL: ArrayIterator and foreach reference
--FILE--
<?php

$arr = array(0=>0, 1=>1, 2=>2);
$obj = new ArrayObject($arr);

foreach($obj as $ak=>&$av) {
	foreach($obj as $bk=>&$bv) {
		if ($ak==0 && $bk==0) {
			$bv = "modify";
		}
		echo "$ak=>$av - $bk=>$bv\n";
	}
}

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
0=>modify - 0=>modify
0=>modify - 1=>1
0=>modify - 2=>2
1=>1 - 0=>modify
1=>1 - 1=>1
1=>1 - 2=>2
2=>2 - 0=>modify
2=>2 - 1=>1
2=>2 - 2=>2
===DONE===