3v4l.org

run code in 200+ 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.0 - 5.4.24, 5.4.34 - 7.2.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 4.3.0 - 5.3.29, 5.4.25 - 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;