xref: /php-src/ext/spl/tests/array_008.phpt (revision f8d79582)
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--EXPECT--
200=>modify - 0=>modify
210=>modify - 1=>1
220=>modify - 2=>2
231=>1 - 0=>modify
241=>1 - 1=>1
251=>1 - 2=>2
262=>2 - 0=>modify
272=>2 - 1=>1
282=>2 - 2=>2
29