3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if ($handle = opendir('/home')) { echo "Directory handle: $handle\n"; echo "Entries:\n"; /* This is the correct way to loop over the directory. */ while (false !== ($entry = readdir($handle))) { echo "$entry\n"; } closedir($handle); }
based on PfcdG
Output for 7.2.0
Warning: opendir(/home): failed to open dir: Permission denied in /in/Zvbd9 on line 3
Output for 5.3.0 - 7.1.10
Directory handle: Resource id #5 Entries: . ..
Output for 5.2.3 - 5.2.17
Directory handle: Resource id #4 Entries: . ..
Output for 4.3.0 - 5.2.2
Directory handle: Resource id #1 Entries: . ..