3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = [0,1,[0,1,[0,1]]]; $dir = new RecursiveArrayIterator($arr); $it = new RecursiveCallbackFilterIterator($dir, function(){return true;}); var_dump($it);
based on 2rBec
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
object(RecursiveCallbackFilterIterator)#2 (0) { }
Output for hhvm-3.12.0
object(RecursiveCallbackFilterIterator)#2 (6) { ["callback":protected]=> object(Closure$;1327793810$c96b772dca39b3f508a313690bef293$)#3 (0) { } ["it":"FilterIterator":private]=> object(RecursiveArrayIterator)#1 (2) { ["storage":"ArrayIterator":private]=> array(3) { [0]=> int(0) [1]=> int(1) [2]=> array(3) { [0]=> int(0) [1]=> int(1) [2]=> array(2) { [0]=> int(0) [1]=> int(1) } } } ["flags":"ArrayIterator":private]=> int(0) } ["iterator":"IteratorIterator":private]=> NULL ["current":"IteratorIterator":private]=> NULL ["key":"IteratorIterator":private]=> NULL ["position":"IteratorIterator":private]=> NULL }
Output for hhvm-3.10.0
object(RecursiveCallbackFilterIterator)#2 (6) { ["callback":protected]=> object(Closure$;1327793810$6d00802c7c75c3f3c2195277973efe3f$)#3 (0) { } ["it":"FilterIterator":private]=> object(RecursiveArrayIterator)#1 (2) { ["storage":"ArrayIterator":private]=> array(3) { [0]=> int(0) [1]=> int(1) [2]=> array(3) { [0]=> int(0) [1]=> int(1) [2]=> array(2) { [0]=> int(0) [1]=> int(1) } } } ["flags":"ArrayIterator":private]=> int(0) } ["iterator":"IteratorIterator":private]=> NULL ["current":"IteratorIterator":private]=> NULL ["key":"IteratorIterator":private]=> NULL ["position":"IteratorIterator":private]=> NULL }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/3sB6Q on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/3sB6Q on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/3sB6Q on line 2
Process exited with code 255.