3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function open_image ($file) { // Get extension $extension = strrchr($file, '.'); $extension = strtolower($extension); switch($extension) { case '.jpg': $im = $file; break; case '.jpeg': $im = @imagecreatefromjpeg($file); break; case '.gif': $im = @imagecreatefromgif($file); break; case '.tiff': $im = @imagecreatefromtiff($file); break; // ... etc default: $im = false; break; } return $im; } ?>
Output for 4.3.0 - 7.1.0