3v4l.org

run code in 300+ PHP versions simultaneously
<!doctype html> <head> <title>Creating an image gallery</title> <style type="text/css"> ul { list-style-type: none; } li { float: left; padding:10px; margin:10px; font:bold 10px Verdana sans-serief; } img { display:block; border:1px solid #333300; margin-border:5px; } </style> </head> <body> <h2>Creating an image gallery</h2> <ul> <?php $photosDir='./picture'; $photosExt=array('gif', 'jpg','jpeg','tif', 'tiff', 'bmp','png'); $photosList=array(); if(file_exists($photosDir)) { $dp=opendir($photosDir) or die ('ERROR: Cannot open Directory'); while($file=readdir($dp)) { if($file!='.' && $file!='..') { $fileData=pathinfo($file); if(in_array($fileData['extension'],$photosExt)) { $photosList[]="$photosDir/$file"; } } } closedir($dp); } else { die('ERROR: Directory doesnot exists.'); } if(count($photosList)>0) { for($x=0; $x<count($photosList); $x++) ?> <li> <img height="150" width="200" src="<?php echo $photosList[$x];?>"/> <?php echo basename($photosList[$x]);?><br/> <?php echo round(filesize($photosList[$x])/1024) . 'KB' ;?> </li> <?php } else { die('ERROR: No image found in Directory.'); } ?> </ul> </body> </html>
Output for git.master, git.master_jit, rfc.property-hooks
<!doctype html> <head> <title>Creating an image gallery</title> <style type="text/css"> ul { list-style-type: none; } li { float: left; padding:10px; margin:10px; font:bold 10px Verdana sans-serief; } img { display:block; border:1px solid #333300; margin-border:5px; } </style> </head> <body> <h2>Creating an image gallery</h2> <ul> Warning: file_exists(): open_basedir restriction in effect. File(./picture) is not within the allowed path(s): (/tmp:/in:/etc) in /in/Gjqpe on line 30 ERROR: Directory doesnot exists.

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:
69.8 ms | 402 KiB | 8 Q