3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Simple file uplaod script. * NO WARRANTY. THIS SCRIPT IS ONLY AN EXAMPLE. * INPUT VALIDATION IS MINIMAL. DO NOT USE IN PRODUCTION * * @copyright 2014 Alex Soban * @license http://opensource.org/licenses/MIT * @author Alex Soban <me@soban.co> */ define('TOKEN', '<secure_token>'); define('UPLOADS', __DIR__ . '/uploads/'); define('URL', 'http://www.example.com/uploads/'); function output(array $data = array()) { header('Content-Type: application/json'); echo json_encode($data); exit; } // `t // get the filename and contents $filename = trim(preg_replace('/[^\d\w.]+/i', '', $_POST['name'])); $image = base64_decode($_POST['image']); // "upload" the file to our uploads directory if (!file_put_contents(UPLOADS . $filename, $image)) { output(array('error' => 'Failed saving file.')); } // return file public URL output(array('href' => URL . $filename));

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.60.0140.00318.78
8.3.50.0140.00722.13
8.3.40.0150.00018.97
8.3.30.0060.00918.84
8.3.20.0080.00019.04
8.3.10.0060.00320.83
8.3.00.0070.01023.66
8.2.180.0130.00717.13
8.2.170.0120.00322.96
8.2.160.0170.00320.14
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0050.00319.73
8.2.110.0100.00022.30
8.2.100.0120.00017.97
8.2.90.0050.00319.17
8.2.80.0040.00417.97
8.2.70.0050.00517.75
8.2.60.0050.00317.80
8.2.50.0100.00318.07
8.2.40.0060.00318.13
8.2.30.0000.00820.00
8.2.20.0000.00717.81
8.2.10.0080.00017.90
8.2.00.0040.00418.00
8.1.280.0070.01425.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0050.00228.09
8.1.240.0060.00322.61
8.1.230.0000.01120.89
8.1.220.0000.00818.77
8.1.210.0090.00018.82
8.1.200.0080.00317.35
8.1.190.0040.00417.66
8.1.180.0000.00818.10
8.1.170.0060.00318.77
8.1.160.0050.00218.85
8.1.150.0040.00418.84
8.1.140.0040.00417.53
8.1.130.0070.00017.91
8.1.120.0040.00417.52
8.1.110.0000.00717.55
8.1.100.0000.00717.57
8.1.90.0040.00417.55
8.1.80.0000.00817.50
8.1.70.0000.00717.58
8.1.60.0040.00417.80
8.1.50.0080.00017.62
8.1.40.0040.00417.58
8.1.30.0040.00417.81
8.1.20.0040.00417.82
8.1.10.0090.00017.73
8.1.00.0040.00417.70
8.0.300.0040.00419.89
8.0.290.0030.00516.88
8.0.280.0080.00018.54
8.0.270.0000.00816.99
8.0.260.0080.00017.03
8.0.250.0080.00017.04
8.0.240.0000.00817.07
8.0.230.0070.00017.14
8.0.220.0040.00417.11
8.0.210.0000.00717.07
8.0.200.0030.00317.16
8.0.190.0070.00017.14
8.0.180.0030.00517.11
8.0.170.0030.00517.16
8.0.160.0000.00717.22
8.0.150.0090.00017.13
8.0.140.0050.00517.12
8.0.130.0000.00613.50
8.0.120.0000.00816.96
8.0.110.0030.00517.11
8.0.100.0040.00417.00
8.0.90.0040.00417.15
8.0.80.0100.00717.16
8.0.70.0000.00717.16
8.0.60.0040.00416.99
8.0.50.0000.00717.22
8.0.30.0100.01117.29
8.0.20.0140.00517.46
8.0.10.0030.00517.34
8.0.00.0080.01317.13
7.4.330.0030.00313.43
7.4.320.0030.00316.70
7.4.300.0030.00316.72
7.4.290.0030.00316.71
7.4.280.0040.00416.73
7.4.270.0040.00416.76
7.4.260.0000.00513.49
7.4.250.0000.00816.61
7.4.240.0030.00316.73
7.4.230.0000.00716.92
7.4.220.0060.01316.83
7.4.210.0070.01016.80
7.4.200.0070.00016.77
7.4.190.0050.00216.87
7.4.160.0110.00816.80
7.4.150.0100.00717.40
7.4.140.0090.00817.86
7.4.130.0060.01316.81
7.4.120.0080.00916.85
7.4.110.0140.00416.66
7.4.100.0170.00716.70
7.4.90.0090.00916.84
7.4.80.0110.01419.04
7.4.70.0140.00316.58
7.4.60.0070.01016.59
7.4.50.0000.00916.95
7.4.40.0100.00722.27
7.4.30.0030.01516.78
7.4.10.0100.00716.54
7.4.00.0080.01015.68
7.3.330.0000.00613.57
7.3.320.0030.00313.39
7.3.310.0080.00016.63
7.3.300.0000.00716.49
7.3.290.0140.00016.59
7.3.280.0080.01016.51
7.3.270.0150.00917.40
7.3.260.0100.00818.24
7.3.250.0150.00316.65
7.3.240.0140.00316.65
7.3.230.0150.00316.69
7.3.210.0090.00916.69
7.3.200.0070.01119.39
7.3.190.0110.01116.53
7.3.180.0050.01116.63
7.3.170.0100.00616.56
7.3.160.0030.01316.64
7.3.130.0000.01316.69
7.3.120.0050.01115.51
7.3.110.0050.01315.79
7.3.100.0080.00915.82
7.3.90.0050.01015.70
7.3.80.0030.00615.79
7.3.70.0080.00515.93
7.3.60.0020.01115.81
7.3.50.0020.01215.84
7.3.40.0050.00615.65
7.3.30.0100.00815.68
7.3.20.0090.00917.56
7.3.10.0130.00217.57
7.3.00.0080.00717.40
7.2.330.0130.00616.94
7.2.320.0110.00516.67
7.2.310.0200.00416.63
7.2.300.0120.00517.09
7.2.290.0150.00316.86
7.2.260.0100.01016.92
7.2.250.0060.01116.16
7.2.240.0050.01015.91
7.2.230.0040.01116.00
7.2.220.0090.00615.98
7.2.210.0030.00915.84
7.2.200.0070.01015.84
7.2.190.0030.01016.04
7.2.180.0020.01016.06
7.2.170.0060.00515.90
7.2.160.0060.01116.06
7.2.150.0040.00818.01
7.2.140.0070.00717.73
7.2.130.0060.00817.69
7.2.120.0060.00817.62
7.2.110.0060.00917.63
7.2.100.0070.00817.59
7.2.90.0050.00917.62
7.2.80.0080.00717.60
7.2.70.0040.00617.61
7.2.60.0060.00617.68
7.2.50.0050.00917.68
7.2.40.0060.00817.64
7.2.30.0080.00517.79
7.2.20.0110.00417.48
7.2.10.0050.01017.60
7.2.00.0080.00618.13
7.1.330.0100.00516.89
7.1.320.0030.00916.94
7.1.310.0020.01016.88
7.1.300.0080.00716.92
7.1.290.0040.01016.90
7.1.280.0050.00816.82
7.1.270.0030.01416.78
7.1.260.0060.00616.76
7.1.250.0070.00716.51
7.1.240.0060.00616.52
7.1.230.0040.01016.51
7.1.220.0020.00816.57
7.1.210.0050.01016.45
7.1.200.0040.00816.57
7.1.190.0060.00516.65
7.1.180.0040.00916.58
7.1.170.0010.01116.55
7.1.160.0060.00716.43
7.1.150.0020.00916.37
7.1.140.0080.00616.47
7.1.130.0070.00516.45
7.1.120.0080.00416.38
7.1.110.0080.00616.40
7.1.100.0060.00716.93
7.1.90.0010.01116.45
7.1.80.0050.00816.38
7.1.70.0040.00616.81
7.1.60.0090.00817.21
7.1.50.0060.00916.74
7.1.40.0080.00616.47
7.1.30.0050.00816.43
7.1.20.0050.00916.57
7.1.10.0070.00716.58
7.1.00.0080.01217.98
7.0.330.0030.00715.96
7.0.320.0020.00915.86
7.0.310.0070.00815.89
7.0.300.0060.01016.03
7.0.290.0070.00616.11
7.0.280.0040.00716.13
7.0.270.0030.00916.01
7.0.260.0040.00816.16
7.0.250.0040.00916.13
7.0.240.0070.00416.02
7.0.230.0060.00815.93
7.0.220.0050.00516.29
7.0.210.0030.00916.06
7.0.200.0050.00616.26
7.0.190.0040.01016.20
7.0.180.0080.00816.08
7.0.170.0050.01016.06
7.0.160.0040.01016.08
7.0.150.0070.00515.98
7.0.140.0040.02517.52
7.0.130.0090.00516.05
7.0.120.0080.00516.09
7.0.110.0060.00716.09
7.0.100.0050.00616.04
7.0.90.0200.02317.04
7.0.80.0170.02017.00
7.0.70.0170.02717.04
7.0.60.0190.02717.13
7.0.50.0190.01417.30
7.0.40.0130.01315.75
7.0.30.0080.02415.72
7.0.20.0080.02515.69
7.0.10.0070.02415.68
7.0.00.0070.02515.71
5.6.400.0050.00815.40
5.6.390.0050.01015.07
5.6.380.0030.01014.94
5.6.370.0040.00814.82
5.6.360.0070.00815.18
5.6.350.0040.00914.86
5.6.340.0050.00715.21
5.6.330.0030.01215.10
5.6.320.0020.01215.11
5.6.310.0030.00914.89
5.6.300.0040.01115.09
5.6.290.0070.00714.86
5.6.280.0040.02516.42
5.6.270.0040.00915.15
5.6.260.0080.00615.03
5.6.250.0040.01015.14
5.6.240.0030.02316.38
5.6.230.0060.02316.34
5.6.220.0010.03116.39
5.6.210.0100.02316.32
5.6.200.0030.01816.46
5.6.190.0050.02616.46
5.6.180.0040.02616.61
5.6.170.0060.02616.56
5.6.160.0030.02016.44
5.6.150.0070.01616.41
5.6.140.0050.02816.61
5.6.130.0050.01816.45
5.6.120.0050.02316.51
5.6.110.0050.02816.59
5.6.100.0060.02716.44
5.6.90.0080.02516.45
5.6.80.0050.02216.21
5.6.70.0030.01816.21
5.6.60.0050.02416.31
5.6.50.0080.02316.27
5.6.40.0080.02516.31
5.6.30.0090.02216.21
5.6.20.0090.01816.28
5.6.10.0030.02016.30
5.6.00.0050.01916.30
5.5.380.0030.01615.57
5.5.370.0050.02315.53
5.5.360.0060.02515.59
5.5.350.0070.01715.49
5.5.340.0070.01615.65
5.5.330.0100.02115.55
5.5.320.0050.01615.64
5.5.310.0090.02315.71
5.5.300.0050.02815.62
5.5.290.0040.02615.64
5.5.280.0060.02415.71
5.5.270.0070.01715.75
5.5.260.0040.02715.73
5.5.250.0060.01915.52
5.5.240.0020.02415.51
5.5.230.0030.02815.47
5.5.220.0040.02215.40
5.5.210.0070.02315.44
5.5.200.0050.02315.49
5.5.190.0030.01815.41
5.5.180.0070.02615.48
5.5.170.0050.00713.78
5.5.160.0050.01515.36
5.5.150.0040.02815.29
5.5.140.0100.01815.31
5.5.130.0060.02415.51
5.5.120.0050.02715.38
5.5.110.0070.02415.44
5.5.100.0030.02215.32
5.5.90.0080.02215.41
5.5.80.0070.02415.51
5.5.70.0030.02415.33
5.5.60.0040.02615.32
5.5.50.0070.01715.40
5.5.40.0110.02215.34
5.5.30.0060.02415.33
5.5.20.0030.01915.34
5.5.10.0120.02015.34
5.5.00.0070.02415.35
5.4.450.0090.02214.41
5.4.440.0070.02114.35
5.4.430.0070.01714.30
5.4.420.0090.02214.44
5.4.410.0080.02314.43
5.4.400.0050.02314.31
5.4.390.0050.02514.34
5.4.380.0070.01814.28
5.4.370.0050.02114.29
5.4.360.0100.01714.24
5.4.350.0050.01614.29
5.4.340.0060.02314.15
5.4.330.0010.00812.75
5.4.320.0040.02214.24
5.4.310.0030.02314.14
5.4.300.0060.02314.20
5.4.290.0050.02214.23
5.4.280.0090.02214.23
5.4.270.0090.01614.32
5.4.260.0040.01814.28
5.4.250.0050.02514.21
5.4.240.0070.01814.32
5.4.230.0040.02314.27
5.4.220.0060.01914.31
5.4.210.0080.02214.26
5.4.200.0040.02314.31
5.4.190.0050.02314.30
5.4.180.0070.01914.27
5.4.170.0080.02214.17
5.4.160.0050.02414.26
5.4.150.0060.02614.24
5.4.140.0080.01713.62
5.4.130.0070.02313.67
5.4.120.0060.01713.66
5.4.110.0020.02013.72
5.4.100.0070.02013.70
5.4.90.0090.01813.57
5.4.80.0060.02313.51
5.4.70.0040.01813.68
5.4.60.0050.02113.61
5.4.50.0040.01413.62
5.4.40.0070.02013.58
5.4.30.0050.02113.64
5.4.20.0040.02413.63
5.4.10.0030.02313.65
5.4.00.0090.01813.44
5.3.290.0040.01513.21
5.3.280.0060.02113.14
5.3.270.0050.02613.13
5.3.260.0040.02313.16
5.3.250.0030.02313.18
5.3.240.0050.01813.14
5.3.230.0040.02313.25
5.3.220.0040.02213.14
5.3.210.0060.01513.16
5.3.200.0020.01413.18
5.3.190.0080.02113.16
5.3.180.0060.02213.22
5.3.170.0070.01713.25
5.3.160.0040.01813.18
5.3.150.0080.02013.23
5.3.140.0040.02313.24
5.3.130.0050.02413.15
5.3.120.0060.01413.18
5.3.110.0030.02513.20
5.3.100.0030.02513.03
5.3.90.0070.02313.08
5.3.80.0060.01713.03
5.3.70.0070.02213.04
5.3.60.0060.02213.02
5.3.50.0060.02013.04
5.3.40.0040.01512.99
5.3.30.0090.01913.02
5.3.20.0050.01512.90
5.3.10.0080.01712.97
5.3.00.0030.02512.82
5.2.170.0020.02210.95
5.2.160.0030.01611.05
5.2.150.0050.02211.06
5.2.140.0020.03511.02
5.2.130.0020.02510.99
5.2.120.0050.03211.06
5.2.110.0050.03310.95
5.2.100.0080.03111.07
5.2.90.0060.03211.05
5.2.80.0030.03311.00
5.2.70.0010.03310.95
5.2.60.0030.02811.03
5.2.50.0050.03010.92
5.2.40.0000.03510.89
5.2.30.0050.03010.99
5.2.20.0030.02510.95
5.2.10.0000.03110.84
5.2.00.0070.03210.84
5.1.60.0060.01610.48
5.1.50.0030.02810.51
5.1.40.0020.02010.47
5.1.30.0040.02810.55
5.1.20.0020.02410.59
5.1.10.0000.02610.48
5.1.00.0020.02910.40
5.0.50.0030.0249.75
5.0.40.0030.0209.68
5.0.30.0070.0279.56
5.0.20.0100.0159.55
5.0.10.0020.0239.58
5.0.00.0050.0339.55
4.4.90.0020.0158.84
4.4.80.0000.0198.84
4.4.70.0020.0208.84
4.4.60.0030.0188.84
4.4.50.0030.0138.84
4.4.40.0030.0148.84
4.4.30.0040.0178.84
4.4.20.0000.0128.84
4.4.10.0040.0108.84
4.4.00.0020.0298.84
4.3.110.0030.0188.84
4.3.100.0030.0158.84
4.3.90.0030.0148.84
4.3.80.0030.0158.84
4.3.70.0020.0198.84
4.3.60.0000.0228.84
4.3.50.0030.0118.84
4.3.40.0000.0278.84
4.3.30.0020.0208.84
4.3.20.0030.0188.84
4.3.10.0030.0138.84
4.3.00.0020.0108.84

preferences:
28.71 ms | 401 KiB | 5 Q