3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php foreach (scandir("/") as $f) { if (is_dir($f)) { $di = new DirectoryIterator($f); echo sprintf("%30s: %d\n", $di->getPathname(), $di->isDir()); } }
Output for 5.6.0 - 7.1.7, 7.2.0, 7.3.0alpha1 - 7.3.0beta1
Warning: scandir(/): failed to open dir: Permission denied in /in/9sLZ0 on line 3 Warning: scandir(): (errno 13): Permission denied in /in/9sLZ0 on line 3 Warning: Invalid argument supplied for foreach() in /in/9sLZ0 on line 3
Output for 7.1.20, 7.2.5 - 7.2.6
Warning: scandir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in) in /in/9sLZ0 on line 3 Warning: scandir(/): failed to open dir: Operation not permitted in /in/9sLZ0 on line 3 Warning: scandir(): (errno 1): Operation not permitted in /in/9sLZ0 on line 3 Warning: Invalid argument supplied for foreach() in /in/9sLZ0 on line 3