3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<? $dir = '\\'; $d = array(); $arr = opendir($dir); while($v = readdir($arr)) { if($v == '.' or $v == '..') continue; if(!is_dir($dir.DIRECTORY_SEPARATOR.$v)) $d[] = $v; if(is_dir($dir.DIRECTORY_SEPARATOR.$v)) $d[$v] = scan($dir.DIRECTORY_SEPARATOR.$v); } return $d;
Output for 5.4.34 - 5.6.28, 7.0.0 - 7.1.0
Warning: opendir(\): failed to open dir: No such file or directory in /in/v4ZSG on line 5 Warning: readdir() expects parameter 1 to be resource, boolean given in /in/v4ZSG on line 9
Output for hhvm-3.12.0
Warning: No such file or directory in /in/v4ZSG on line 5 Warning: readdir() expects parameter 1 to be resource, boolean given in /in/v4ZSG on line 9
Output for hhvm-3.10.0
Warning: No such file or directory in /in/v4ZSG on line 21 Warning: readdir() expects parameter 1 to be resource, boolean given in /in/v4ZSG on line 23
Output for 4.3.0 - 5.4.32
<? $dir = '\\'; $d = array(); $arr = opendir($dir); while($v = readdir($arr)) { if($v == '.' or $v == '..') continue; if(!is_dir($dir.DIRECTORY_SEPARATOR.$v)) $d[] = $v; if(is_dir($dir.DIRECTORY_SEPARATOR.$v)) $d[$v] = scan($dir.DIRECTORY_SEPARATOR.$v); } return $d;