3v4l.org

run code in 300+ PHP versions simultaneously
<?php function write_log($txt) { file_put_contents("put_log.txt", $txt); chmod("put_log.txt", 0666); } require 'dauth.php'; // customize the following defines:- define('AUTH_REALM', 'myserver/mydirectory'); define('URL_BASE', 'http://myserver/mydirectory'); /* --- The following sample authorization function uses an array of user names and passwords defined and fixed here. An actual implementation might read the array from an external resource. The use of an ArrayIterator makes it moderately easy to extend this mechanism. --- */ function authorize() { $auth = new authorizer(AUTH_REALM, new ArrayIterator(array('user1' => 'password1', 'user2' => 'password2'))); $auth->check(); // dies if not OK } function puterror($status, $body, $log = FALSE) { header ("HTTP/1.1 $status"); if ($log) write_log($log); die("<html><head><title>Error $status</title></head><body>$body</body></html>"); } function putfile() { $f = pathinfo($fname = $_SERVER['REQUEST_URI']); if ($f['extension'] != 'html') puterror('403 Forbidden', "Bad file type in $fname"); $f = fopen($fname = $f['basename'], 'w'); if (!$f) puterror('409 Create error', "Couldn't create file"); $s = fopen('php://input', 'r'); // read from standard input if (!$s) puterror('404 Input Unavailable', "Couldn't open input"); while($kb = fread($s, 1024)) fwrite($f, $kb, 1024); fclose($f); fclose($s); chmod($fname, 0666); $fname = URL_BASE . $fname; header("Location: $fname"); header("HTTP/1.1 201 Created"); echo "<html><head><title>Success</title></head><body>"; echo "<p>Created <a href='$fname'>$fname</a> OK.</p></body></html>"; } if ($_SERVER['REQUEST_METHOD'] != 'PUT') header("HTTP/1.1 403 Bad Request"); else { authorize(); putfile(); // uncommment the next line to debug misbehaviour //write_log(date('c') . "\n" . $_SERVER['REQUEST_URI'] . "\nStatus: $retcode; } ?>

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.0100.01018.63
8.3.50.0120.00721.99
8.3.40.0060.00918.79
8.3.30.0140.00718.97
8.3.20.0080.00018.81
8.3.10.0050.00320.71
8.3.00.0040.00423.61
8.2.180.0110.00716.88
8.2.170.0080.00622.96
8.2.160.0070.00720.53
8.2.150.0050.00325.66
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00819.36
8.2.110.0040.00819.19
8.2.100.0000.01217.91
8.2.90.0090.00019.22
8.2.80.0080.00017.97
8.2.70.0000.00917.50
8.2.60.0090.00017.55
8.2.50.0060.00618.07
8.2.40.0060.00318.22
8.2.30.0000.00819.85
8.2.20.0000.00817.77
8.2.10.0000.00917.85
8.2.00.0040.00417.82
8.1.280.0040.01125.92
8.1.270.0000.00823.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0070.00321.24
8.1.230.0110.00017.51
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0030.00717.35
8.1.190.0090.00317.22
8.1.180.0080.00018.10
8.1.170.0040.00418.46
8.1.160.0000.00718.94
8.1.150.0050.00318.58
8.1.140.0040.00417.43
8.1.130.0030.00617.80
8.1.120.0000.00717.43
8.1.110.0040.00417.32
8.1.100.0040.00417.45
8.1.90.0080.00017.43
8.1.80.0050.00317.42
8.1.70.0000.00717.42
8.1.60.0050.00317.63
8.1.50.0040.00417.57
8.1.40.0000.00817.54
8.1.30.0000.00817.70
8.1.20.0000.00817.58
8.1.10.0040.00417.51
8.1.00.0030.00617.46
8.0.300.0040.00418.77
8.0.290.0050.00317.00
8.0.280.0030.00318.46
8.0.270.0040.00417.30
8.0.260.0060.00016.95
8.0.250.0000.00817.16
8.0.240.0060.00317.09
8.0.230.0020.00517.11
8.0.220.0030.00317.05
8.0.210.0030.00317.10
8.0.200.0050.00217.04
8.0.190.0000.00717.07
8.0.180.0060.00317.02
8.0.170.0040.00417.07
8.0.160.0070.00017.16
8.0.150.0040.00416.99
8.0.140.0000.00817.11
8.0.130.0060.00013.36
8.0.120.0030.00516.95
8.0.110.0040.00416.89
8.0.100.0050.00217.01
8.0.90.0040.00417.02
8.0.80.0090.00617.10
8.0.70.0000.00717.14
8.0.60.0040.00416.91
8.0.50.0000.00717.17
8.0.30.0110.00817.02
8.0.20.0090.01017.40
8.0.10.0040.00417.01
8.0.00.0070.01216.83
7.4.330.0030.00313.43
7.4.320.0000.00816.70
7.4.300.0000.00616.48
7.4.290.0070.00016.61
7.4.280.0000.00816.41
7.4.270.0040.00416.55
7.4.260.0000.00513.26
7.4.250.0030.00616.52
7.4.240.0000.00716.59
7.4.230.0030.00316.61
7.4.220.0140.00716.54
7.4.210.0100.00716.65
7.4.200.0000.00716.36
7.4.190.0000.00716.66
7.4.160.0120.00316.43
7.4.150.0130.00617.40
7.4.140.0080.01017.86
7.4.130.0140.00516.59
7.4.120.0110.00816.58
7.4.110.0120.00616.58
7.4.100.0140.00516.52
7.4.90.0130.00616.60
7.4.80.0080.01419.04
7.4.70.0040.01516.61
7.4.60.0120.00616.55
7.4.50.0040.00416.27
7.4.40.0020.01122.27
7.4.30.0070.01016.58
7.4.00.0110.00714.87
7.3.330.0020.00213.15
7.3.320.0000.00513.27
7.3.310.0000.00716.30
7.3.300.0000.00716.23
7.3.290.0090.00916.36
7.3.280.0060.01016.35
7.3.270.0090.00917.40
7.3.260.0120.00818.24
7.3.250.0140.00716.47
7.3.240.0130.00316.41
7.3.230.0070.01016.41
7.3.210.0150.00316.41
7.3.200.0140.01119.39
7.3.190.0160.00916.56
7.3.180.0100.00616.52
7.3.170.0110.00716.66
7.3.160.0110.00716.23
7.3.120.0040.00814.77
7.3.10.0090.00616.50
7.3.00.0060.00316.26
7.2.330.0100.00716.48
7.2.320.0120.00616.62
7.2.310.0070.01016.51
7.2.300.0060.01016.61
7.2.290.0130.00616.67
7.2.130.0060.00316.38
7.2.120.0070.00316.71
7.2.110.0140.00316.51
7.2.100.0040.00716.77
7.2.90.0050.00916.52
7.2.80.0030.01016.62
7.2.70.0130.00716.93
7.2.60.0100.00816.56
7.2.50.0040.01116.37
7.2.40.0110.00416.66
7.2.30.0040.01116.86
7.2.20.0030.00716.63
7.2.10.0090.00616.58
7.2.00.0060.00616.80
7.1.250.0090.00015.67
7.1.70.0070.00416.67
7.1.60.0100.01319.40
7.1.50.0170.00716.83
7.1.00.0000.06322.45
7.0.200.0000.00816.57
7.0.140.0000.07721.99
7.0.60.0030.04019.96
7.0.50.0100.03317.94
7.0.40.0270.06720.05
7.0.30.0300.04720.25
7.0.20.0370.07320.10
7.0.10.0200.07720.25
7.0.00.0130.07720.13
5.6.280.0070.07021.16
5.6.210.0070.06320.71
5.6.200.0070.08318.20
5.6.190.0070.06720.61
5.6.180.0000.04720.63
5.6.170.0270.05320.50
5.6.160.0100.07720.49
5.6.150.0100.07718.26
5.6.140.0000.05018.19
5.6.130.0070.06018.23
5.6.120.0000.05721.14
5.6.110.0130.08021.06
5.6.100.0070.05721.05
5.6.90.0100.08020.90
5.6.80.0070.08020.42
5.6.70.0300.07720.43
5.5.350.0030.08020.49
5.5.340.0030.06717.97
5.5.330.0270.07020.13
5.5.320.0000.04320.36
5.5.310.0230.04020.31
5.5.300.0100.08318.01
5.5.290.0100.08017.96
5.5.280.0070.04020.75
5.5.270.0030.04320.81
5.5.260.0100.04720.99
5.5.250.0100.06720.66
5.5.240.0170.06320.38
5.4.450.0130.06719.58
5.4.440.0030.06719.57
5.4.430.0100.07319.57
5.4.420.0000.05719.18
5.4.410.0100.05319.38
5.4.400.0070.04319.25
5.4.390.0070.06319.25
5.4.380.0070.05318.86
5.4.370.0070.08019.25
5.4.360.0100.06319.25
5.4.350.0130.07318.99
5.4.340.0030.05018.86
5.4.320.0030.08019.26
5.4.310.0030.04019.09
5.4.300.0070.07719.08
5.4.290.0130.06318.98
5.4.280.0100.03719.15
5.4.270.0000.04318.85
5.4.260.0100.07719.25
5.4.250.0200.05319.15
5.4.240.0070.04019.15
5.4.230.0030.04719.20
5.4.220.0100.07319.24
5.4.210.0100.06719.24
5.4.200.0030.05719.15
5.4.190.0030.04318.97
5.4.180.0030.04019.20
5.4.170.0030.07719.14
5.4.160.0070.08019.14
5.4.150.0070.03719.23
5.4.140.0130.07316.41
5.4.130.0100.05016.45
5.4.120.0070.03316.39
5.4.110.0030.05316.34
5.4.100.0130.06016.59
5.4.90.0170.04716.44
5.4.80.0030.06316.71
5.4.70.0070.04716.43
5.4.60.0000.05016.28
5.4.50.0030.05316.28
5.4.40.0130.07016.46
5.4.30.0000.05316.27
5.4.20.0070.04016.39
5.4.10.0100.04016.32
5.4.00.0000.04715.74
5.3.290.0070.08014.84
5.3.280.0030.07314.61
5.3.270.0170.06314.65
5.3.260.0070.08014.66
5.3.250.0000.04314.54
5.3.240.0170.03714.55
5.3.230.0070.04314.77
5.3.220.0030.05714.75
5.3.210.0030.06014.48
5.3.200.0000.08314.50
5.3.190.0030.05314.58
5.3.180.0030.07714.58
5.3.170.0100.07014.58
5.3.160.0070.03714.60
5.3.150.0100.06714.58
5.3.140.0070.04314.58
5.3.130.0070.03714.61
5.3.120.0070.04314.49
5.3.110.0070.03714.46
5.3.100.0070.04013.98
5.3.90.0130.07014.03
5.3.80.0070.04713.98
5.3.70.0030.04314.04
5.3.60.0100.03314.18
5.3.50.0070.04314.02
5.3.40.0070.03313.86
5.3.30.0030.05013.93
5.3.20.0030.05313.61
5.3.10.0030.05713.70
5.3.00.0070.07313.68
5.2.170.0070.03311.20
5.2.160.0030.03311.21
5.2.150.0030.05011.22
5.2.140.0070.04011.16
5.2.130.0070.03011.19
5.2.120.0000.03311.02
5.2.110.0030.05011.08
5.2.100.0000.06311.20
5.2.90.0130.05711.27
5.2.80.0130.05311.04
5.2.70.0030.07011.06
5.2.60.0070.06311.04
5.2.50.0000.07011.20
5.2.40.0070.05711.17
5.2.30.0070.05011.05
5.2.20.0030.06311.04
5.2.10.0100.04310.93
5.2.00.0030.05010.75
5.1.60.0030.05010.08
5.1.50.0100.03010.19
5.1.40.0070.05310.06
5.1.30.0030.03010.30
5.1.20.0070.05710.45
5.1.10.0070.04310.28
5.1.00.0030.05310.17
5.0.50.0000.0479.46
5.0.40.0070.0439.46
5.0.30.0070.0539.46
5.0.20.0000.0239.46
5.0.10.0130.0239.46
5.0.00.0000.0539.46
4.4.90.0000.0339.46
4.4.80.0030.0309.46
4.4.70.0000.0379.46
4.4.60.0000.0339.46
4.4.50.0000.0309.46
4.4.40.0030.0339.46
4.4.30.0000.0409.46
4.4.20.0000.0379.46
4.4.10.0000.0339.46
4.4.00.0070.0339.46
4.3.110.0030.0279.46
4.3.100.0000.0239.46
4.3.90.0030.0309.46
4.3.80.0030.0479.46
4.3.70.0000.0309.46
4.3.60.0030.0239.46
4.3.50.0030.0339.46
4.3.40.0000.0539.46
4.3.30.0000.0239.46
4.3.20.0000.0379.46
4.3.10.0070.0309.46
4.3.00.0030.0309.46

preferences:
48.68 ms | 401 KiB | 5 Q