3v4l.org

run code in 300+ PHP versions simultaneously
<?php $uploads_folder = "/home/yourUnixUsername/public_html/uploads/"; $web_folder = "/uploads/"; $image_requested = $_GET['pic']; // filename from url $images = array(); if(file_exists($uploads_folder.$image_requested) // if that image exists, get every image from that folder { if ($dh = opendir($uploads_folder)) { $inc = 0; while (($file = readdir($dh)) !== false) { if (!is_dir($uploads_folder.$file)) { $images[$inc]=$web_folder.$file; // construct a web path to image $inc++; } } closedir($dh); } } foreach($images as $an_image) { echo '<img src="'.$an_image.'">'; } ?>
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.27
Parse error: syntax error, unexpected '{' in /in/NV6ea on line 11
Process exited with code 255.

preferences:
170.86 ms | 1395 KiB | 64 Q