3v4l.org

run code in 300+ PHP versions simultaneously
<?php function genRandomString() { $length = 10; $characters = "0123456789abcdefghijklmnopqrstuvwxyz"; $string = ""; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters)-1)]; } return $string; } function makeRandomPath($dir, $ext) { do { $path = $dir."/".genRandomString().".".$ext; } while(file_exists($path)); return $path; } function makeRandomPathFromFilename($dir, $fn) { $ext = pathinfo($fn, PATHINFO_EXTENSION); return makeRandomPath($dir, $ext); } if(array_key_exists("filename", $_POST)) { $target_path = makeRandomPathFromFilename("upload", $_POST["filename"]); if(filesize($_FILES['uploadedfile']['tmp_name']) > 1000) { echo "File is too big"; } else if (! exif_imagetype($_FILES['uploadedfile']['tmp_name'])) { echo "File is not an image"; } else { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file <a href=\"$target_path\">$target_path</a> has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } } else { ?> <form enctype="multipart/form-data" action="index.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="1000" /> <input type="hidden" name="filename" value="<? print genRandomString(); ?>.jpg" /> Choose a JPEG to upload (max 1KB):<br/> <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <?php } ?>

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.0.120.0090.00313.31
8.0.110.0080.00413.37
8.0.100.0080.00413.32
8.0.90.0110.00213.35
8.0.80.0060.00613.29
8.0.70.0090.00313.34
8.0.60.0120.00013.38
8.0.50.0080.00413.29
8.0.30.0090.00313.41
8.0.20.0000.01213.42
8.0.10.0040.00813.49
8.0.00.0030.00313.48
7.4.250.0070.00013.23
7.4.240.0090.00413.38
7.4.230.0100.00313.33
7.4.220.0060.00613.29
7.4.210.0140.00013.29
7.4.200.0120.00013.26
7.4.190.0090.00413.43
7.4.180.0120.00213.34
7.4.160.0090.00413.30
7.4.150.0130.00013.26
7.4.140.0100.00213.20
7.4.130.0110.00213.23
7.4.120.0080.00013.25
7.4.110.0100.00013.20
7.4.100.0040.00813.41
7.4.90.0090.00313.25
7.4.80.0070.00513.35
7.4.70.0090.00413.22
7.4.60.0100.00013.29
7.4.50.0060.00613.16
7.4.40.0070.00713.06
7.4.30.0060.00613.25
7.4.20.0070.00413.22
7.4.10.0080.00514.12
7.4.00.0040.01013.97
7.3.310.0060.00313.18
7.3.300.0000.00813.09
7.3.290.0070.00213.22
7.3.280.0090.00013.23
7.3.270.0060.00513.11
7.3.260.0090.00013.15
7.3.250.0090.00013.35
7.3.240.0040.00413.20
7.3.230.0060.00313.16
7.3.220.0060.00313.07
7.3.210.0070.00013.16
7.3.200.0050.00513.16
7.3.190.0030.00613.26
7.3.180.0040.00413.11
7.3.170.0060.00313.30
7.3.160.0050.00513.35
7.3.150.0040.00413.13
7.3.140.0040.00413.24
7.3.130.0060.00713.91
7.3.120.0100.00314.17
7.3.110.0070.00513.79
7.3.100.0040.00614.01
7.3.90.0030.00914.12
7.3.80.0080.00114.02
7.3.70.0020.00713.97
7.3.60.0040.00714.08
7.3.50.0070.00614.00
7.3.40.0000.00814.05
7.3.30.0050.00514.15
7.3.20.0060.00315.92
7.3.10.0070.00415.66
7.3.00.0060.00515.94
7.2.340.0000.01213.42
7.2.330.0100.00313.44
7.2.320.0040.00813.29
7.2.310.0090.00313.21
7.2.300.0080.00413.52
7.2.290.0060.00613.38
7.2.280.0000.01213.44
7.2.270.0120.00013.39
7.2.260.0120.00314.17
7.2.250.0070.00714.26
7.2.240.0100.00314.25
7.2.230.0090.00314.15
7.2.220.0090.00514.05
7.2.210.0050.00914.08
7.2.200.0090.00314.23
7.2.190.0110.00514.20
7.2.180.0060.00514.34
7.2.170.0040.00814.29
7.2.160.0080.00514.18
7.2.150.0080.00316.14
7.2.140.0080.00716.01
7.2.130.0090.00416.16
7.2.120.0080.00416.09
7.2.110.0080.00416.05
7.2.100.0080.00616.21
7.2.90.0040.01016.14
7.2.80.0080.00716.17
7.2.70.0090.00516.21
7.2.60.0110.00316.14
7.2.50.0120.00216.10
7.2.40.0120.00216.07
7.2.30.0130.00216.08
7.2.20.0110.00316.19
7.2.10.0000.01316.11
7.2.00.0070.00717.07
7.1.330.0060.00614.95
7.1.320.0080.00614.98
7.1.310.0100.00315.04
7.1.300.0070.00715.05
7.1.290.0080.00415.04
7.1.280.0100.00314.91
7.1.270.0050.00714.95
7.1.260.0050.00914.95
7.1.250.0060.00414.83
7.1.240.0050.00814.89
7.1.230.0080.00514.93
7.1.220.0050.00915.11
7.1.210.0090.00414.89
7.1.200.0070.00614.92
7.1.190.0120.00215.10
7.1.180.0090.00715.06
7.1.170.0050.00614.80
7.1.160.0070.00414.95
7.1.150.0050.00715.04
7.1.140.0120.00214.86
7.1.130.0060.00614.92
7.1.120.0050.00914.90
7.1.110.0050.00714.96
7.1.100.0110.00115.02
7.1.90.0110.00214.91
7.1.80.0060.00715.08
7.1.70.0070.00415.70
7.1.60.0080.00816.45
7.1.50.0050.01215.58
7.1.40.0070.00815.06
7.1.30.0100.00114.86
7.1.20.0080.00515.01
7.1.10.0050.00514.85
7.1.00.0100.01217.38
7.0.330.0100.00214.68
7.0.320.0050.01014.59
7.0.310.0070.00514.60
7.0.300.0060.00614.84
7.0.290.0040.00914.74
7.0.280.0070.00614.70
7.0.270.0080.00314.82
7.0.260.0100.00314.81
7.0.250.0110.00314.63
7.0.240.0060.00614.91
7.0.230.0090.00314.83
7.0.220.0070.00514.68
7.0.210.0080.00314.63
7.0.200.0080.00315.32
7.0.190.0060.00814.81
7.0.180.0050.00714.65
7.0.170.0060.00614.73
7.0.160.0070.00614.64
7.0.150.0080.00514.84
7.0.140.0030.03017.12
7.0.130.0050.00614.65
7.0.120.0080.00514.90
7.0.110.0050.00614.79
7.0.100.0050.00714.77
7.0.90.0050.00914.75
7.0.80.0100.00514.79
7.0.70.0070.00514.54
7.0.60.0060.03116.36
7.0.50.0090.01415.87
7.0.40.0080.03015.96
7.0.30.0230.02715.82
7.0.20.0170.02715.81
7.0.10.0100.01915.93
7.0.00.0050.03416.00
5.6.400.0060.00713.61
5.6.390.0060.00613.50
5.6.380.0070.00513.70
5.6.370.0100.00313.43
5.6.360.0080.00413.27
5.6.350.0110.00013.53
5.6.340.0070.00513.52
5.6.330.0090.00313.70
5.6.320.0090.00513.56
5.6.310.0100.00313.58
5.6.300.0070.00513.61
5.6.290.0090.00413.61
5.6.280.0020.03116.03
5.6.270.0080.00413.61
5.6.260.0100.00213.34
5.6.250.0090.00313.63
5.6.240.0080.00513.69
5.6.230.0050.00613.70
5.6.220.0060.00413.58
5.6.210.0070.02615.89
5.6.200.0090.01815.16
5.6.190.0110.02615.77
5.6.180.0120.01815.88
5.6.170.0190.02215.81
5.6.160.0090.01615.93
5.6.150.0060.02315.10
5.6.140.0080.02115.06
5.6.130.0080.02615.10
5.6.120.0100.03016.09
5.6.110.0010.02215.95
5.6.100.0060.02715.93
5.6.90.0050.03416.03
5.6.80.0100.03015.80
5.6.70.1390.01415.91
5.6.60.0120.00013.65
5.6.50.0050.00913.54
5.6.40.0070.00613.45
5.6.30.0100.00413.51
5.6.20.0080.00813.45
5.6.10.0090.00513.44
5.6.00.0110.00213.46
5.5.380.0030.01213.49
5.5.370.0110.00413.45
5.5.360.0070.00513.61
5.5.350.0080.03015.75
5.5.340.0080.03014.99
5.5.330.0060.02315.77
5.5.320.0120.01615.70
5.5.310.0140.02915.75
5.5.300.0080.01415.13
5.5.290.0060.02315.00
5.5.280.0030.03215.90
5.5.270.0090.03015.92
5.5.260.0070.03015.93
5.5.250.0070.01715.95
5.5.240.0060.03015.71
5.5.230.0040.00613.32
5.5.220.0060.00513.41
5.5.210.0030.00813.29
5.5.200.0040.00813.35
5.5.190.0070.00513.56
5.5.180.0080.00513.36
5.5.170.0050.00813.27
5.5.160.0110.00213.46
5.5.150.0080.00513.44
5.5.140.0080.00213.35
5.5.130.0060.00613.33
5.5.120.0120.00013.42
5.5.110.0040.00613.27
5.5.100.0040.00813.70
5.5.90.0110.00213.53
5.5.80.0080.00313.38
5.5.70.0050.00413.50
5.5.60.0040.00713.55
5.5.50.0090.00213.52
5.5.40.0060.00613.41
5.5.30.0040.00613.32
5.5.20.0040.00813.31
5.5.10.0070.00513.39
5.5.00.0050.00613.46
5.4.450.1460.01414.32
5.4.440.1170.01814.50
5.4.430.1110.01614.40
5.4.420.1200.01114.59
5.4.410.1160.01614.51
5.4.400.1200.01514.16
5.4.390.1150.01614.25
5.4.380.1160.01614.29
5.4.370.1130.01514.25
5.4.360.1140.01714.33
5.4.350.1090.01814.40
5.4.340.0930.01514.26
5.4.330.0020.00711.95
5.4.320.1180.01414.50
5.4.310.1330.01614.22
5.4.300.1160.01914.40
5.4.290.1330.01614.35
5.4.280.1180.01414.38
5.4.270.1150.01614.20
5.4.260.1180.01314.24
5.4.250.1080.01514.34
5.4.240.1150.01614.23
5.4.230.1130.01814.24
5.4.220.1140.01614.19
5.4.210.1070.01514.32
5.4.200.1140.01714.12
5.4.190.1380.01314.36
5.4.180.1150.01714.19
5.4.170.1130.01614.37
5.4.160.1150.01614.26
5.4.150.1320.01814.22
5.4.140.1030.01913.45
5.4.130.1160.01413.39
5.4.120.1220.01713.42
5.4.110.1140.01613.44
5.4.100.0030.01713.38
5.4.90.0050.01513.63
5.4.80.1230.01313.63
5.4.70.1190.01513.41
5.4.60.1150.01513.58
5.4.50.1180.01413.41
5.4.40.1190.01213.49
5.4.30.1210.01513.49
5.4.20.1130.01613.44
5.4.10.1170.01613.51
5.4.00.1170.01413.22
5.3.290.1170.01912.75
5.3.280.1150.01512.53
5.3.270.1160.01512.72
5.3.260.1130.01412.58
5.3.250.1120.01712.59
5.3.240.1160.01712.67
5.3.230.1120.01612.67
5.3.220.1200.01312.58
5.3.210.1180.01312.56
5.3.200.0560.01512.67
5.3.190.0150.01412.68
5.3.180.1070.01612.70
5.3.170.0970.02012.61
5.3.160.1150.01612.71
5.3.150.1090.01312.69
5.3.140.1280.01912.63
5.3.130.1120.01912.74
5.3.120.1070.01612.65
5.3.110.1250.01512.61
5.3.100.1180.01412.51
5.3.90.1160.01712.55
5.3.80.1160.01412.43
5.3.70.0840.01512.35
5.3.60.0060.02212.48
5.3.50.0070.01312.43
5.3.40.1230.01512.38
5.3.30.1370.01612.37
5.3.20.1340.01712.39
5.3.10.1120.01512.13
5.3.00.1020.01312.32
5.2.170.0100.02511.56
5.2.160.0860.01711.75
5.2.150.1630.01911.61
5.2.140.1510.02011.57
5.2.130.1460.01311.57
5.2.120.1480.01011.55
5.2.110.1460.01511.65
5.2.100.1440.01811.57
5.2.90.1350.01311.42
5.2.80.1430.01811.49
5.2.70.1400.01811.36
5.2.60.1270.01911.30
5.2.50.1690.01011.32
5.2.40.1160.01411.42
5.2.30.1000.01711.29
5.2.20.1120.01911.26
5.2.10.1160.01511.20
5.2.00.1180.01311.23
5.1.60.1140.01310.50
5.1.50.1250.01410.67
5.1.40.1160.01410.59
5.1.30.1030.01210.77
5.1.20.1210.01010.82
5.1.10.1210.01310.60
5.1.00.1180.01410.60
5.0.50.0570.01310.33
5.0.40.0580.01010.33
5.0.30.0580.01710.33
5.0.20.0550.01210.33
5.0.10.0680.01310.33
5.0.00.0570.01610.33
4.4.90.0670.00810.33
4.4.80.0570.00810.33
4.4.70.0600.00510.33
4.4.60.0690.00710.33
4.4.50.0680.01010.33
4.4.40.0600.01310.33
4.4.30.0570.00810.33
4.4.20.0570.00810.33
4.4.10.0570.00810.33
4.4.00.0560.01410.33
4.3.110.0530.01010.33
4.3.100.0530.01010.33
4.3.90.0490.01010.33
4.3.80.0580.01210.33
4.3.70.0620.00710.33
4.3.60.0570.00810.33
4.3.50.0680.01010.33
4.3.40.0570.01210.33
4.3.30.0280.01010.33
4.3.20.0310.00710.33
4.3.10.0300.01010.33
4.3.00.0300.00610.33

preferences:
46.6 ms | 401 KiB | 5 Q