3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: access"); header("Access-Control-Allow-Methods: GET"); header("Access-Control-Allow-Credentials: true"); header("Content-Type: application/json; charset=UTF-8"); function getResponse() { if (!isset($_GET['id']) || !ctype_digit($_GET['id'])) { return ['message' => 'Missing/Invalid identifier provided']; } include_once('config_setup.php'); $sql = "SELECT id, caption, filename, description2 FROM photographs WHERE id = " . $_GET['id']; $result = mysqli_query($db, $sql); if (!$result) { return ['message' => 'Please contact the dev team.']; } $photo = mysqli_fetch_assoc($result); if (!$photo) { return ['message' => 'No product.']; } $url = 'http://localhost/photo_gallery/public/files/images/'; $allowed = '<div><img><h1><h2><p><br><strong><em><ul><li><table><td><tr><th><tbody>'; return [ 'id' => urlencode(htmlspecialchars($photo['id'])), 'caption' => htmlspecialchars($photo['caption']), 'filename' => $url . htmlspecialchars($photo['filename']), 'description2' => strip_tags($photo['description2'], $allowed), ]; } $response = getResponse(); http_response_code(isset($response['message']) ? 404 : 200); echo json_encode($response);

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.0060.00918.18
8.3.60.0120.00316.38
8.3.50.0070.00717.89
8.3.40.0120.00319.34
8.3.30.0160.00018.90
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.180.0100.01025.92
8.2.170.0100.00322.96
8.2.160.0100.01022.96
8.2.150.0080.00025.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00326.35
8.2.110.0000.01019.30
8.2.100.0070.00719.58
8.2.90.0030.00517.75
8.2.80.0000.00918.90
8.2.70.0080.00017.63
8.2.60.0000.00817.93
8.2.50.0040.00818.07
8.2.40.0030.00520.07
8.2.30.0070.00018.00
8.2.20.0040.00418.20
8.2.10.0070.00019.30
8.2.00.0000.00719.38
8.1.280.0130.00325.92
8.1.270.0040.00423.96
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0040.00423.97
8.1.230.0070.00417.89
8.1.220.0080.00017.89
8.1.210.0040.00818.77
8.1.200.0030.00617.35
8.1.190.0080.00417.10
8.1.180.0080.00018.10
8.1.170.0050.00318.75
8.1.160.0080.00018.96
8.1.150.0000.00818.89
8.1.140.0040.00419.00
8.1.130.0000.00820.02
8.1.120.0000.00717.33
8.1.110.0000.00817.39
8.1.100.0000.00717.36
8.1.90.0050.00217.53
8.1.80.0020.00817.48
8.1.70.0030.00317.51
8.1.60.0020.00517.48
8.1.50.0040.00417.53
8.1.40.0050.00317.45
8.1.30.0000.00817.60
8.1.20.0030.00617.66
8.1.10.0080.00017.55
8.1.00.0050.00317.53
8.0.300.0070.00018.77
8.0.290.0040.00416.63
8.0.280.0000.00718.38
8.0.270.0030.00318.04
8.0.260.0040.00420.20
8.0.250.0000.00716.85
8.0.240.0000.00716.96
8.0.230.0030.00516.96
8.0.220.0000.00716.82
8.0.210.0030.00316.90
8.0.200.0030.00316.90
8.0.190.0040.00416.86
8.0.180.0000.00816.81
8.0.170.0090.00016.85
8.0.160.0030.00516.98
8.0.150.0000.00716.90
8.0.140.0030.00316.90
8.0.130.0050.00013.21
8.0.120.0000.00916.76
8.0.110.0000.00716.86
8.0.100.0000.00716.88
8.0.90.0060.00316.74
8.0.80.0100.00516.89
8.0.70.0000.00816.85
8.0.60.0040.00416.87
8.0.50.0050.00216.75
8.0.30.0140.00716.93
8.0.20.0150.00616.82
8.0.10.0000.00717.14
8.0.00.0120.01516.77
7.4.330.0000.00515.55
7.4.320.0060.00016.53
7.4.300.0030.00316.50
7.4.290.0000.00716.53
7.4.280.0080.00016.57
7.4.270.0000.00716.55
7.4.260.0050.00013.35
7.4.250.0030.00316.64
7.4.240.0000.00716.62
7.4.230.0040.00416.40
7.4.220.0020.00616.48
7.4.210.0100.01016.62
7.4.200.0080.00016.36
7.4.130.0110.00916.60
7.4.120.0150.00716.64
7.4.110.0030.01416.40
7.4.100.0130.00316.72
7.4.90.0070.01116.52
7.4.80.0100.01319.39
7.4.70.0130.00316.44
7.4.60.0130.00316.34
7.4.50.0140.00316.20
7.4.40.0070.00916.33
7.4.30.0070.00716.55
7.4.20.0110.00616.68
7.4.10.0090.00916.27
7.4.00.0030.01316.64
7.3.330.0070.00016.18
7.3.320.0050.00013.28
7.3.310.0030.00316.19
7.3.300.0000.00716.36
7.3.290.0040.01016.33
7.3.260.0100.01316.34
7.3.240.0100.00816.46
7.3.230.0160.00016.23
7.3.210.0080.00916.37
7.3.200.0040.01316.32
7.3.190.0060.01016.33
7.3.180.0100.00616.19
7.3.170.0110.00416.13
7.3.160.0060.01016.25
7.3.150.0100.01016.13
7.3.140.0090.00616.46
7.3.130.0090.00616.39
7.3.120.0150.00016.30
7.3.110.0140.00916.28
7.3.100.0120.01116.41
7.3.90.0150.00016.27
7.3.80.0100.01016.52
7.3.70.0110.01216.26
7.3.60.0140.00816.30
7.3.50.0130.00316.24
7.3.40.0130.00416.25
7.3.30.0000.01516.36
7.3.20.0120.00316.22
7.3.10.0140.00316.47
7.3.00.0180.00416.42
7.2.330.0130.01016.52
7.2.320.0120.00916.39
7.2.310.0110.00716.39
7.2.300.0120.00416.37
7.2.290.0030.01216.50
7.2.280.0090.01316.60
7.2.270.0060.00916.32
7.2.260.0080.00916.34
7.2.250.0100.00616.35
7.2.240.0110.00716.57
7.2.230.0070.01616.48
7.2.220.0130.01016.67
7.2.210.0070.01616.41
7.2.200.0180.00616.53
7.2.190.0120.00816.38
7.2.180.0110.00616.62
7.2.170.0100.00616.63
7.2.160.0060.01016.55
7.2.150.0070.01116.54
7.2.140.0070.01116.67
7.2.130.0090.00916.80
7.2.120.0070.01016.52
7.2.110.0120.00616.51
7.2.100.0120.00616.43
7.2.90.0070.01016.46
7.2.80.0060.01216.58
7.2.70.0180.00616.35
7.2.60.0120.01216.40
7.2.50.0100.00616.35
7.2.40.0110.00516.57
7.2.30.0170.00016.60
7.2.20.0180.00016.64
7.2.10.0060.01216.42
7.2.00.0030.01516.54

preferences:
53.63 ms | 401 KiB | 5 Q