3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("TOP",0); define("BOTTOM",1); define("LEFT",2); define("RIGHT",3); function perspective($i,$gradient=0.85,$rightdown=TOP,$background=0xFFFFFF, $alpha=0) { $w=imagesx($i); $h=imagesy($i); $col=imagecolorallocatealpha($i,($background>>16)&0xFF,($background>>8)&0xFF,$background&0xFF,$alpha); $mult=5; $li=imagecreatetruecolor($w*$mult,$h*$mult); imagealphablending($li,false); imagefilledrectangle($li,0,0,$w*$mult,$h*$mult,$col); imagesavealpha($li,true); imagecopyresized($li,$i,0,0,0,0,$w*$mult,$h*$mult,$w,$h); imagedestroy($i); $w*=$mult; $h*=$mult; $image=imagecreatetruecolor($w,$h); imagealphablending($image,false); imagefilledrectangle($image,0,0,$w,$h,$col); imagealphablending($image,true); imageantialias($image,true); $test=$h*$gradient; $rdmod=$rightdown%2; $min=1; if($rightdown<2){ for($y=0;$y<$h;$y++){ $ny=$rdmod? $y : $h-$y; $off=round((1-$gradient)*$w*($ny/$h)); $t=((1-pow(1-pow(($ny/$h),2),0.5))*(1-$gradient)+($ny/$h)*$gradient); $nt=$rdmod? $t : 1-$t; if(abs(0.5-$nt)<$min){ $min=abs(0.5-$nt); $naty=$off; } imagecopyresampled($image,$li, round($off/2),$y, 0,abs($nt*$h), $w-$off,1, $w,1); } } else { for($x=0;$x<$w;$x++){ $nx=$rdmod? $x : $w-$x; $off=round((1-$gradient)*$h*($nx/$w)); $t=((1-pow(1-pow(($nx/$w),2),0.5))*(1-$gradient)+($nx/$w)*$gradient); $nt=$rdmod? $t : 1-$t; if(abs(0.5-$nt)<$min){ $min=abs(0.5-$nt); $natx=$off; } imagecopyresampled($image,$li, $x,round($off/2), abs($nt*$w),0, 1,$h-$off, 1,$h); } } imagedestroy($li); imageantialias($image,false); imagealphablending($image,false); imagesavealpha($image,true); $i=imagecreatetruecolor(($w+$naty)/$mult,($h+$natx)/$mult); imagealphablending($i,false); imagefilledrectangle($i,0,0,($w+$naty)/$mult,($h+$natx)/$mult,$col); imagealphablending($i,true); imageantialias($i,true); imagecopyresampled($i,$image,0,0,0,0,($w+$naty)/$mult,($h+$natx)/$mult,$w,$h); imagedestroy($image); imagealphablending($i,false); imageantialias($i,false); imagesavealpha($i,true); return $i; } $img=perspective("http://i.imgur.com/iX5Aski.png",0.2,RIGHT,0xFFFFFF,127);

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)
8.4.120.0060.00320.77
8.4.110.0120.00820.50
8.4.100.0070.01018.87
8.4.90.0090.01020.70
8.4.80.0100.00819.12
8.4.70.0140.00619.00
8.4.60.0140.00718.55
8.4.50.0050.00420.26
8.4.40.0100.01018.09
8.4.30.0130.00718.02
8.4.20.0120.00917.94
8.4.10.0170.00317.97
8.3.250.0110.00817.30
8.3.240.0140.00516.78
8.3.230.0110.00616.98
8.3.220.0100.00818.92
8.3.210.0090.01116.96
8.3.200.0040.00516.98
8.3.190.0070.00917.23
8.3.180.0120.00619.17
8.3.170.0110.00716.67
8.3.160.0060.01217.39
8.3.150.0090.00017.31
8.3.140.0120.00318.57
8.3.130.0050.00318.65
8.3.120.0030.00620.67
8.3.110.0070.01120.94
8.3.100.0000.00824.06
8.3.90.0040.00426.77
8.3.80.0090.00317.97
8.3.70.0120.00316.88
8.3.60.0140.00418.52
8.3.50.0140.00522.95
8.3.40.0150.00018.99
8.3.30.0110.00418.76
8.3.20.0050.00220.16
8.3.10.0080.00020.52
8.3.00.0050.00320.63
8.2.290.0100.00920.60
8.2.280.0120.00720.29
8.2.270.0160.00316.66
8.2.260.0050.00316.96
8.2.250.0000.00818.37
8.2.240.0000.00919.08
8.2.230.0090.00022.58
8.2.220.0030.00637.54
8.2.210.0000.00726.77
8.2.200.0090.00318.29
8.2.190.0150.00318.66
8.2.180.0070.01016.63
8.2.170.0070.00722.96
8.2.160.0110.00722.08
8.2.150.0090.00024.18
8.2.140.0100.00024.66
8.2.130.0160.00020.45
8.2.120.0000.00826.35
8.2.110.0060.00320.38
8.2.100.0070.00418.03
8.2.90.0040.00418.41
8.2.80.0040.00418.34
8.2.70.0050.00317.93
8.2.60.0030.00618.05
8.2.50.0080.00518.10
8.2.40.0050.00320.59
8.2.30.0000.00919.42
8.2.20.0000.00817.89
8.2.10.0040.00418.23
8.2.00.0050.00318.17
8.1.330.0070.00721.59
8.1.320.0120.00716.05
8.1.310.0030.00616.26
8.1.300.0030.00520.11
8.1.290.0030.00630.84
8.1.280.0100.01025.92
8.1.270.0040.00423.91
8.1.260.0050.00328.09
8.1.250.0090.00028.09
8.1.240.0060.00322.56
8.1.230.0080.00422.75
8.1.220.0080.00017.91
8.1.210.0000.00818.83
8.1.200.0030.00617.35
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0030.00518.77
8.1.160.0070.00022.25
8.1.150.0000.00818.87
8.1.140.0030.00519.58
8.1.130.0000.00717.71
8.1.120.0040.00417.52
8.1.110.0050.00217.42
8.1.100.0050.00317.41
8.1.90.0040.00417.50
8.1.80.0000.00717.46
8.1.70.0050.00217.48
8.1.60.0060.00317.60
8.1.50.0090.00017.57
8.1.40.0050.00317.53
8.1.30.0030.00617.64
8.1.20.0030.00517.74
8.1.10.0030.00517.67
8.1.00.0030.00517.60
8.0.300.0040.00420.15
8.0.290.0060.00316.88
8.0.280.0070.00018.49
8.0.270.0030.00317.32
8.0.260.0000.00717.33
8.0.250.0000.00717.03
8.0.240.0000.00617.14
8.0.230.0030.00317.05
8.0.220.0000.00717.00
8.0.210.0060.00317.05
8.0.200.0000.00617.01
8.0.190.0050.00317.01
8.0.180.0040.00416.98
8.0.170.0030.00617.07
8.0.160.0040.00417.04
8.0.150.0040.00417.02
8.0.140.0000.00717.00
8.0.130.0000.00613.57
8.0.120.0050.00316.99
8.0.110.0050.00316.89
8.0.100.0000.00717.01
8.0.90.0000.00816.87
8.0.80.0120.00416.95
8.0.70.0040.00416.91
8.0.60.0080.00017.02
8.0.50.0040.00416.93
8.0.30.0060.01117.12
8.0.20.0110.01017.40
8.0.10.0080.00016.97
8.0.00.0100.00816.87
7.4.330.0050.00016.84
7.4.320.0030.00316.53
7.4.300.0060.00016.64
7.4.290.0000.00916.66
7.4.280.0000.00916.54
7.4.270.0000.00716.47
7.4.260.0030.00616.48
7.4.250.0040.00416.40
7.4.240.0040.00316.64
7.4.230.0070.00016.38
7.4.220.0100.00616.58
7.4.210.0090.00616.53
7.4.200.0040.00416.72
7.4.160.0040.01516.76
7.4.150.0080.01717.40
7.4.140.0150.00617.86
7.4.130.0140.00516.54
7.4.120.0090.01016.60
7.4.110.0100.01016.56
7.4.100.0000.02016.54
7.4.90.0070.01016.50
7.4.80.0080.00819.39
7.4.70.0060.01216.39
7.4.60.0130.00316.56
7.4.50.0060.00916.43
7.4.40.0130.00316.46
7.4.30.0080.00816.50
7.4.10.0060.01115.15
7.4.00.0080.00815.21
7.3.330.0020.00513.42
7.3.320.0050.00013.35
7.3.310.0070.00016.46
7.3.300.0030.00316.41
7.3.290.0080.00816.38
7.3.280.0060.00916.38
7.3.270.0090.00917.40
7.3.260.0150.00616.54
7.3.250.0080.01216.43
7.3.240.0100.01016.44
7.3.230.0080.00816.57
7.3.210.0120.00916.50
7.3.200.0040.01516.52
7.3.190.0030.01316.37
7.3.180.0130.00316.34
7.3.170.0060.01016.65
7.3.160.0030.01216.52
7.3.130.0100.01014.98
7.3.120.0070.01115.00
7.3.110.0000.01615.05
7.3.100.0030.01014.93
7.3.90.0040.01214.89
7.3.80.0130.00014.64
7.3.70.0040.01115.01
7.3.60.0040.01414.88
7.3.50.0050.00814.99
7.3.40.0060.00314.98
7.3.30.0040.00814.80
7.3.20.0090.00616.68
7.3.10.0090.00616.73
7.3.00.0050.00416.73
7.2.330.0080.00816.84
7.2.320.0030.01716.78
7.2.310.0030.01416.56
7.2.300.0040.01416.41
7.2.290.0050.01116.53
7.2.260.0030.01615.00
7.2.250.0130.00714.96
7.2.240.0070.00715.00
7.2.230.0070.00314.90
7.2.220.0040.01114.77
7.2.210.0040.00815.02
7.2.200.0100.00315.21
7.2.190.0060.01215.06
7.2.180.0000.01514.99
7.2.170.0110.00415.07
7.2.160.0030.01014.86
7.2.150.0060.01016.78
7.2.140.0100.00016.82
7.2.130.0060.00616.79
7.2.120.0100.00716.84
7.2.110.0040.00816.75
7.2.100.0050.00516.76
7.2.90.0100.00616.97
7.2.80.0100.00616.95
7.2.70.0030.01016.59
7.2.60.0030.01016.72
7.2.50.0070.00716.91
7.2.40.0060.00616.87
7.2.30.0120.00016.90
7.2.20.0070.00716.58
7.2.10.0100.00316.76
7.2.00.0090.00818.04
7.1.330.0100.00315.66
7.1.320.0040.01115.49
7.1.310.0030.00615.60
7.1.300.0030.00815.45
7.1.290.0030.00615.76
7.1.280.0030.00915.69
7.1.270.0040.00815.45
7.1.260.0070.00715.74
7.1.250.0040.00415.49
7.1.240.0100.00315.90
7.1.230.0030.00715.77
7.1.220.0030.00615.58
7.1.210.0070.00715.49
7.1.200.0070.00515.50
7.1.190.0040.00415.71
7.1.180.0070.00715.86
7.1.170.0000.01315.82
7.1.160.0040.00415.69
7.1.150.0040.00715.76
7.1.140.0080.00615.73
7.1.130.0040.00715.66
7.1.120.0030.01415.76
7.1.110.0040.00815.56
7.1.100.0060.00816.79
7.1.90.0110.00415.74
7.1.80.0090.00615.85
7.1.70.0020.00616.34
7.1.60.0030.01017.70
7.1.50.0070.00716.27
7.1.40.0000.01215.69
7.1.30.0030.01215.71
7.1.20.0070.00715.70
7.1.10.0030.01315.83
7.1.00.0060.03518.98
7.0.330.0040.00415.33
7.0.320.0070.00715.29
7.0.310.0090.00615.33
7.0.300.0040.01115.07
7.0.290.0040.00715.47
7.0.280.0060.00615.52
7.0.270.0030.00915.14
7.0.260.0030.00715.30
7.0.250.0100.00015.32
7.0.240.0030.00515.39
7.0.230.0100.00315.22
7.0.220.0050.00515.45
7.0.210.0070.00715.51
7.0.200.0500.00415.00
7.0.190.0050.00315.43
7.0.180.0100.00315.43
7.0.170.0030.00915.44
7.0.160.0030.01115.50
7.0.150.0040.01115.15
7.0.140.0080.00815.37
7.0.130.0090.00615.41
7.0.120.0030.01015.50
7.0.110.0040.00415.45
7.0.100.0070.02517.63
7.0.90.0140.03017.74
7.0.80.0070.04217.67
7.0.70.0000.04817.53
7.0.60.0110.02517.72
7.0.50.0090.05017.89
7.0.40.0020.03016.83
7.0.30.0070.04516.77
7.0.20.0040.02716.69
7.0.10.0100.04216.77
7.0.00.0050.03516.78
5.6.400.0090.00014.39
5.6.390.0030.01014.12
5.6.380.0070.00714.17
5.6.370.0060.01214.28
5.6.360.0040.01114.53
5.6.350.0090.00614.32
5.6.340.0000.01414.23
5.6.330.0070.00414.20
5.6.320.0050.00514.27
5.6.310.0110.00414.33
5.6.300.0060.00914.49
5.6.290.0040.01114.20
5.6.280.0090.03617.58
5.6.270.0040.00414.23
5.6.260.0040.00714.43
5.6.250.0140.03317.48
5.6.240.0110.04017.39
5.6.230.0030.03517.42
5.6.220.0070.04517.35
5.6.210.0060.04817.45
5.6.200.0030.03317.68
5.6.190.0060.02617.79
5.6.180.0080.03217.60
5.6.170.0090.02417.64
5.6.160.0110.03917.63
5.6.150.0130.03717.76
5.6.140.0100.03617.66
5.6.130.0050.03117.69
5.6.120.0130.02517.73
5.6.110.0080.04217.52
5.6.100.0020.05717.63
5.6.90.0070.04717.71
5.6.80.0110.03717.35
5.6.70.0080.04117.39
5.6.60.0060.02817.21
5.6.50.0050.02317.29
5.6.40.0100.02417.40
5.6.30.0070.02517.36
5.6.20.0070.04317.16
5.6.10.0080.04317.17
5.6.00.0080.03417.49
5.5.380.0020.02717.49
5.5.370.0050.04417.29
5.5.360.0070.04717.34
5.5.350.0050.04717.34
5.5.340.0050.04517.34
5.5.330.0030.04517.46
5.5.320.0070.03217.45
5.5.310.0050.04417.59
5.5.300.0070.02817.57
5.5.290.0080.04217.42
5.5.280.0060.04517.61
5.5.270.0070.03017.46
5.5.260.0060.02517.52
5.5.250.0060.04317.41
5.5.240.0070.02717.17
5.5.230.0070.04216.96
5.5.220.0080.04217.11
5.5.210.0100.04017.21
5.5.200.0060.02517.15
5.5.190.0050.02817.09
5.5.180.0020.03117.25
5.5.170.0090.00313.75
5.5.160.0050.04317.18
5.5.150.0070.02817.23
5.5.140.0130.03317.10
5.5.130.0080.03917.11
5.5.120.0110.03817.11
5.5.110.0070.04317.13
5.5.100.0080.03516.90
5.5.90.0070.03717.08
5.5.80.0080.03117.12
5.5.70.0100.02217.07
5.5.60.0110.03716.84
5.5.50.0000.03117.02
5.5.40.0050.02617.02
5.5.30.0070.04116.96
5.5.20.0090.04217.05
5.5.10.0110.04017.18
5.5.00.0090.04217.13

preferences:
130.79 ms | 403 KiB | 5 Q