3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function GalleryList() { echo ' <div class="GalleryGrid"> <ul>'; error_reporting(E_ALL); $thumbs = array_diff(scandir('images/Thumbs'),array ('..','.','Thumbs.db')); foreach ($thumbs as $key => $current) { $imagelist[filectime('images/Thumbs/'.$current)] = $current; } krsort($imagelist); foreach ($imagelist as $key => $thumb) { $fullImage = substr($thumb,6); echo '<li><a href="images/'.$fullImage.'"><img src="images/Thumbs/'.$thumb.'"> </a> </li>'.PHP_EOL; } echo '</ul>'; } GalleryList();
Output for 5.0.0 - 7.1.0
<div class="GalleryGrid"> <ul> Warning: scandir(images/Thumbs): failed to open dir: No such file or directory in /in/8X2Sl on line 8 Warning: scandir(): (errno 2): No such file or directory in /in/8X2Sl on line 8 Warning: array_diff(): Argument #1 is not an array in /in/8X2Sl on line 8 Warning: Invalid argument supplied for foreach() in /in/8X2Sl on line 9 Warning: krsort() expects parameter 1 to be array, null given in /in/8X2Sl on line 12 Warning: Invalid argument supplied for foreach() in /in/8X2Sl on line 15 </ul>
Output for 4.4.5 - 4.4.9
<div class="GalleryGrid"> <ul> Fatal error: Call to undefined function: scandir() in /in/8X2Sl on line 8
Process exited with code 255.
Output for 4.3.2 - 4.4.4
<div class="GalleryGrid"> <ul> Fatal error: Call to undefined function: scandir() in /in/8X2Sl on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<div class="GalleryGrid"> <ul> Fatal error: Call to undefined function: scandir() in /in/8X2Sl on line 8