xref: /PHP-8.2/ext/spl/tests/spl_001.phpt (revision f8d79582)
1--TEST--
2SPL: iterator_to_array() and iterator_count()
3--FILE--
4<?php
5
6$it = new ArrayObject(array("x"=>1, 1=>2, 3=>3, 4, "1"=>5));
7
8$ar = iterator_to_array($it);
9
10var_dump(iterator_count($it));
11
12print_r($ar);
13
14foreach($ar as $v)
15{
16    var_dump($v);
17}
18
19?>
20--EXPECT--
21int(4)
22Array
23(
24    [x] => 1
25    [1] => 5
26    [3] => 3
27    [4] => 4
28)
29int(1)
30int(5)
31int(3)
32int(4)
33