3v4l.org

run code in 300+ PHP versions simultaneously
<?php // open this directory $myDirectory = opendir("/"); // get each entry while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; } // close directory closedir($myDirectory); // count elements in array $indexCount = count($dirArray); Print ("$indexCount files<br>\n"); // sort 'em sort($dirArray); // print 'em print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n"); print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n"); // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>"); print("<td>"); print(filetype($dirArray[$index])); print("</td>"); print("<td>"); print(filesize($dirArray[$index])); print("</td>"); print("</TR>\n"); } } print("</TABLE>\n");
Output for git.master, git.master_jit
Warning: opendir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/VTj2e on line 2 Warning: opendir(/): Failed to open directory: Operation not permitted in /in/VTj2e on line 2 Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, bool given in /in/VTj2e:5 Stack trace: #0 /in/VTj2e(5): readdir(false) #1 {main} thrown in /in/VTj2e on line 5
Process exited with code 255.
Output for rfc.property-hooks
Warning: opendir(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/tmp:/in:/etc) in /in/VTj2e on line 2 Warning: opendir(/): Failed to open directory: Operation not permitted in /in/VTj2e on line 2 Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given in /in/VTj2e:5 Stack trace: #0 /in/VTj2e(5): readdir(false) #1 {main} thrown in /in/VTj2e on line 5
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
55 ms | 401 KiB | 8 Q