3v4l.org

run code in 300+ PHP versions simultaneously
<?php // mock $_GET['f'] = 'imagenes'; $_GET['folder'] = 'foods'; $_GET['type'] = 'salads'; $_GET['desc'] = 'green'; $_GET['dim'] = '50'; $_GET['id'] = '23'; // define expected $params = ['f', 'folder', 'type', 'desc', 'dim', 'id']; // loop over and output: /imagenes/foods/salads/green_50/23.png $path = null; foreach ($params as $key => $param) { if (isset($_GET[$param])) { $path .= ($param == 'dim' ? '_' : '/').basename($_GET[$param]); unset($params[$key]); } } $path .= '.png'; echo $path; __halt_compiler(); // check all params were passed if (!empty($params)) { die('Invalid request'); } // check file exists if (!file_exists($path)) { die('File does not exist'); } // check file is image if (!getimagesize($path)) { die('Invalid image'); } // all good serve file header("Content-Type: image/png"); header('Content-Length: '.filesize($path)); readfile($path);

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.3.70.0110.01116.63
8.3.60.0140.00718.55
8.3.50.0050.01217.33
8.3.40.0150.00318.76
8.3.30.0070.00718.84
8.3.20.0040.00420.34
8.3.10.0060.00321.82
8.3.00.0050.00319.51
8.2.190.0140.00716.58
8.2.180.0070.01418.14
8.2.170.0140.00722.96
8.2.160.0100.00322.20
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0090.00021.04
8.2.110.0100.00022.21
8.2.100.0110.00017.91
8.2.90.0050.00317.75
8.2.80.0000.00818.73
8.2.70.0030.00517.63
8.2.60.0030.00617.63
8.2.50.0030.00617.55
8.2.40.0060.00319.48
8.2.30.0030.00617.73
8.2.20.0040.00418.06
8.2.10.0090.00018.16
8.2.00.0000.00718.31
8.1.280.0100.01025.92
8.1.270.0040.00420.01
8.1.260.0030.00526.35
8.1.250.0000.00728.09
8.1.240.0040.00423.96
8.1.230.0000.01119.14
8.1.220.0050.00318.60
8.1.210.0030.00618.77
8.1.200.0060.00317.23
8.1.190.0000.01016.98
8.1.180.0060.00318.10
8.1.170.0050.00317.62
8.1.160.0030.00518.77
8.1.150.0040.00420.18
8.1.140.0000.00717.70
8.1.130.0050.00318.92
8.1.120.0070.00017.51
8.1.110.0020.00517.44
8.1.100.0060.00317.36
8.1.90.0000.00717.34
8.1.80.0040.00417.44
8.1.70.0070.00017.36
8.1.60.0060.00317.55
8.1.50.0040.00417.54
8.1.40.0000.00717.50
8.1.30.0080.00017.61
8.1.20.0030.00517.57
8.1.10.0040.00417.62
8.1.00.0040.00417.51
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0040.00417.96
8.0.270.0050.00318.11
8.0.260.0000.00617.26
8.0.250.0070.00017.05
8.0.240.0000.00816.99
8.0.230.0000.00716.96
8.0.220.0000.00716.93
8.0.210.0070.00016.91
8.0.200.0000.01016.93
8.0.190.0070.00017.01
8.0.180.0040.00416.92
8.0.170.0000.00816.91
8.0.160.0090.00016.86
8.0.150.0030.00416.87
8.0.140.0080.00016.79
8.0.130.0030.00313.33
8.0.120.0030.00716.85
8.0.110.0050.00216.91
8.0.100.0030.00516.82
8.0.90.0060.00316.86
8.0.80.0090.00616.93
8.0.70.0040.00416.68
8.0.60.0040.00416.91
8.0.50.0030.00516.87
8.0.30.0070.01017.10
8.0.20.0150.00817.40
8.0.10.0040.00416.88
8.0.00.0140.00416.62
7.4.330.0050.00015.55
7.4.320.0070.00016.53
7.4.300.0000.00616.52
7.4.290.0030.00316.61
7.4.280.0050.00316.59
7.4.270.0030.00316.49
7.4.260.0000.00816.54
7.4.250.0030.00516.59
7.4.240.0000.00716.65
7.4.230.0000.00716.37
7.4.220.0000.00716.66
7.4.210.0130.00316.63
7.4.200.0000.00716.36
7.4.160.0130.00716.54
7.4.150.0070.01017.40
7.4.140.0080.01217.86
7.4.130.0080.00816.41
7.4.120.0130.01416.54
7.4.110.0040.01216.43
7.4.100.0100.00816.58
7.4.90.0110.00816.74
7.4.80.0120.00619.39
7.4.70.0070.01416.50
7.4.60.0060.01016.47
7.4.50.0080.00816.34
7.4.40.0120.00316.47
7.4.00.0070.01015.01
7.3.330.0020.00313.07
7.3.320.0000.00613.02
7.3.310.0040.00416.31
7.3.300.0000.00716.36
7.3.290.0060.00716.33
7.3.280.0080.00616.36
7.3.270.0140.00317.40
7.3.260.0070.01116.40
7.3.250.0110.00816.36
7.3.240.0100.00916.43
7.3.230.0090.00616.42
7.3.210.0090.00916.36
7.3.200.0070.01016.30
7.3.190.0090.00616.27
7.3.180.0060.01016.68
7.3.170.0070.01016.46
7.3.160.0120.00816.46
7.3.10.0110.00316.54
7.3.00.0040.01116.57
7.2.330.0090.00916.55
7.2.320.0000.02316.43
7.2.310.0000.01616.64
7.2.300.0150.00916.45
7.2.290.0060.01116.55
7.2.130.0000.01116.73
7.2.120.0030.00616.78
7.2.110.0000.00816.98
7.2.100.0070.00717.01
7.2.90.0070.00716.73
7.2.80.0070.00716.71
7.2.70.0080.00816.93
7.2.60.0090.00617.00
7.2.50.0100.00316.92
7.2.40.0070.01016.98
7.2.30.0090.00617.06
7.2.20.0060.00616.94
7.2.10.0080.01317.42
7.2.00.0130.00717.56
7.1.250.0090.00315.79
7.1.200.0000.01315.77
7.1.130.0220.00616.63
7.1.120.0180.00916.84
7.1.110.0180.01116.15
7.1.100.0190.01316.30
7.1.90.0240.00715.84
7.1.80.0140.01116.14
7.1.70.0100.01415.34
7.1.60.0350.00733.23
7.1.50.0350.00633.05
7.1.40.0310.01032.53
7.1.30.0310.01032.59
7.1.20.0240.01732.64
7.1.10.0140.01014.55
7.1.00.0200.00914.80

preferences:
17.99 ms | 401 KiB | 5 Q