xref: /PHP-7.4/ext/spl/tests/dualiterator_001.phpt (revision 26dfce7f)
1--TEST--
2SPL: DualIterator
3--FILE--
4<?php
5
6function spl_examples_autoload($classname)
7{
8	include(__DIR__ . '/' . strtolower($classname) . '.inc');
9}
10
11spl_autoload_register('spl_examples_autoload');
12
13function test($a, $b, $identical = false)
14{
15	var_dump(DualIterator::compareIterators(
16					new RecursiveArrayIterator($a),
17					new RecursiveArrayIterator($b),
18					$identical));
19}
20
21test(array(1,2,3), array(1,2,3));
22test(array(1,2,3), array(1,2));
23test(array(1,array(21,22),3), array(1,array(21,22),3));
24test(array(1,array(21,22),3), array(1,array(21,22,23),3));
25test(array(1,array(21,22),3), array(1,array(21,22,3)));
26test(array(1,array(21,22),3), array(1,array(21),array(22),3));
27test(array(1,2,3), array(1,"2",3), false);
28test(array(1,2,3), array(1,"2",3), true);
29test(array(1,array(21,22),3), array(1,array(21,"22"),3), false);
30test(array(1,array(21,22),3), array(1,array(21,"22"),3), true);
31
32?>
33===DONE===
34<?php exit(0); ?>
35--EXPECT--
36bool(true)
37bool(false)
38bool(true)
39bool(false)
40bool(false)
41bool(false)
42bool(true)
43bool(false)
44bool(true)
45bool(false)
46===DONE===
47