3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?PHP $path = $_SERVER['DOCUMENT_ROOT']; $dir = "."; echo '<table width="80%" border="1"> <tr> <td align="right">Path :</td> <td><a href="'.$path.'">Parent directory</a></td> <td>3</td> </tr>'; // Sort in ascending order - this is default $a = scandir($dir); foreach($a as $key => $value) { echo' <tr> <td>'.$value.'</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr>'; } echo '</table>'; ?>
Output for 5.2.3 - 7.1.0
<table width="80%" border="1"> <tr> <td align="right">Path :</td> <td><a href="">Parent directory</a></td> <td>3</td> </tr> Warning: scandir(.): failed to open dir: Permission denied in /in/XJaqu on line 13 Warning: scandir(): (errno 13): Permission denied in /in/XJaqu on line 13 Warning: Invalid argument supplied for foreach() in /in/XJaqu on line 14 </table>
Output for 5.0.0 - 5.2.2
Notice: Undefined index: DOCUMENT_ROOT in /in/XJaqu on line 3 <table width="80%" border="1"> <tr> <td align="right">Path :</td> <td><a href="">Parent directory</a></td> <td>3</td> </tr> Warning: scandir(.): failed to open dir: Permission denied in /in/XJaqu on line 13 Warning: scandir(): (errno 13): Permission denied in /in/XJaqu on line 13 Warning: Invalid argument supplied for foreach() in /in/XJaqu on line 14 </table>
Output for 4.4.5 - 4.4.9
Notice: Undefined index: DOCUMENT_ROOT in /in/XJaqu on line 3 <table width="80%" border="1"> <tr> <td align="right">Path :</td> <td><a href="">Parent directory</a></td> <td>3</td> </tr> Fatal error: Call to undefined function: scandir() in /in/XJaqu on line 13
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Undefined index: DOCUMENT_ROOT in /in/XJaqu on line 3 <table width="80%" border="1"> <tr> <td align="right">Path :</td> <td><a href="">Parent directory</a></td> <td>3</td> </tr> Fatal error: Call to undefined function: scandir() in /in/XJaqu on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined index: DOCUMENT_ROOT in /in/XJaqu on line 3 <table width="80%" border="1"> <tr> <td align="right">Path :</td> <td><a href="">Parent directory</a></td> <td>3</td> </tr> Fatal error: Call to undefined function: scandir() in /in/XJaqu on line 13