xref: /PHP-8.2/ext/spl/tests/array_004.phpt (revision f8d79582)
1--TEST--
2SPL: ArrayIterator
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            $arr[0] = "modify";
13        }
14        echo "$ak=>$av - $bk=>$bv\n";
15    }
16}
17
18echo "Done\n";
19?>
20--EXPECT--
210=>0 - 0=>0
220=>0 - 1=>1
230=>0 - 2=>2
241=>1 - 0=>0
251=>1 - 1=>1
261=>1 - 2=>2
272=>2 - 0=>0
282=>2 - 1=>1
292=>2 - 2=>2
30Done
31