xref: /PHP-8.2/ext/spl/tests/iterator_026.phpt (revision f8d79582)
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--EXPECTF--
200=>1
21hasNext: yes
221=>2
23hasNext: yes
24
25Warning: Array to string conversion in %s on line %d
260=>31
27hasNext: yes
281=>32
29hasNext: yes
30
31Warning: Array to string conversion in %s on line %d
320=>331
33hasNext: no
343=>4
35hasNext: no
36