3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php // thumb width $square = 150; $large = 200; $small = 100; ////////////////////////////////////////////////////////////////////////////////// square if( isset($_GET["img"]) && ( $_GET["type"] == "square" || $_GET["type"] == "" ) ){ // thumb size $thumb_width = $square; $thumb_height = $square; // align $align = $_GET["align"]; // image source $imgSrc = $_GET["img"]; $imgExt = substr($imgSrc,-3); // image extension if($imgExt == "jpg"){ $myImage = imagecreatefromjpeg($imgSrc); } if($imgExt == "gif"){ $myImage = imagecreatefromgif($imgSrc); } if($imgExt == "png"){ $myImage = imagecreatefrompng($imgSrc); } // getting the image dimensions list($width_orig, $height_orig) = getimagesize($imgSrc); // ratio $ratio_orig = $width_orig/$height_orig; // landscape or portrait? if ($thumb_width/$thumb_height > $ratio_orig) { $new_height = $thumb_width/$ratio_orig; $new_width = $thumb_width; } else { $new_width = $thumb_height*$ratio_orig; $new_height = $thumb_height; } } // middle

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.10.0030.04720.15
7.0.00.0000.04320.22
5.6.160.0070.06720.39
5.6.150.0030.04718.20
5.6.140.0070.03718.15
5.6.130.0170.07018.27
5.6.120.0070.08321.00
5.6.110.0100.04020.98
5.6.100.0070.03720.98
5.6.90.0030.07320.92
5.6.80.0070.06720.36
5.5.300.0030.08317.95
5.5.290.0070.06317.98
5.5.280.0100.03720.74
5.5.270.0170.07320.76
5.5.260.0030.05720.79
5.5.250.0070.06320.68
5.5.240.0200.07020.26

preferences:
133.55 ms | 1398 KiB | 7 Q