xref: /PHP-7.3/ext/spl/tests/iterator_026.phpt (revision 610c7fbe)
1--TEST--
2SPL: CachingIterator::hasNext()
3--FILE--
4<?php
5
6$ar = array(1, 2, array(31, 32, array(331)), 4);
7
8$it = new RecursiveArrayIterator($ar);
9$it = new RecursiveCachingIterator($it);
10$it = new RecursiveIteratorIterator($it);
11
12foreach($it as $k=>$v)
13{
14	echo "$k=>$v\n";
15	echo "hasNext: " . ($it->getInnerIterator()->hasNext() ? "yes" : "no") . "\n";
16}
17
18?>
19===DONE===
20<?php exit(0); ?>
21--EXPECTF--
220=>1
23hasNext: yes
241=>2
25hasNext: yes
26
27Notice: Array to string conversion in %siterator_026.php on line %d
280=>31
29hasNext: yes
301=>32
31hasNext: yes
32
33Notice: Array to string conversion in %siterator_026.php on line %d
340=>331
35hasNext: no
363=>4
37hasNext: no
38===DONE===
39