3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); /** * Created in PhpStorm. * User: 750430 * Date: 04/03/2016 * Time: 20:52 */ include __DIR__.'/db_settings.php'; // try/catch to connect to the db and create the database using a prepared statement if it doesn't exist. try{ $pdo = new PDO("mysql:host' . HOST.'; charset='.CHARSET.';port='.POST.'", $user, $pass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare("CREATE DATABASE IF NOT EXISTS $db"); $stmt->execute(); $results["meta"]["feedback"] = "Database created."; return $results; } catch (PDOException $e) { echo 'Create DB failed: ' . $e->getMessage(); } try{ $stmt = $pdo->prepare("USE $db"); $stmt->execute(); $error = 'use db'; throw new Exception($error); } catch (PDOException $e) { echo 'DB use failed: ' . $e->getMessage(); } try{ $stmt = $pdo->query(DATABASE_INIT); $stmt->execute(); $error = 'create tables'; throw new Exception($error); } catch (PDOException $e) { echo 'Create tables failed: ' . $e->getMessage(); } echo ini_get('display_errors');

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.0150.00016.50
8.3.60.0040.01516.88
8.3.50.0120.00721.93
8.3.40.0040.01118.57
8.3.30.0120.00318.76
8.3.20.0080.00018.93
8.3.10.0000.00819.89
8.3.00.0090.00019.54
8.2.180.0060.00918.50
8.2.170.0030.01322.96
8.2.160.0060.01019.24
8.2.150.0140.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00420.93
8.2.120.0080.00026.35
8.2.110.0030.00722.11
8.2.100.0000.01217.84
8.2.90.0000.00917.91
8.2.80.0040.00419.09
8.2.70.0000.00917.63
8.2.60.0040.00418.03
8.2.50.0070.00318.10
8.2.40.0000.00820.61
8.2.30.0000.00720.54
8.2.20.0030.00517.71
8.2.10.0000.00718.14
8.2.00.0040.00418.10
8.1.280.0150.00325.92
8.1.270.0000.00823.81
8.1.260.0070.00028.09
8.1.250.0000.00728.09
8.1.240.0030.00622.02
8.1.230.0040.00820.97
8.1.220.0030.00517.74
8.1.210.0030.00618.77
8.1.200.0030.00617.25
8.1.190.0000.00817.35
8.1.180.0030.00518.10
8.1.170.0080.00018.62
8.1.160.0000.01020.85
8.1.150.0080.00018.73
8.1.140.0030.00719.54
8.1.130.0030.00317.48
8.1.120.0000.00817.50
8.1.110.0030.00617.47
8.1.100.0000.00717.43
8.1.90.0040.00417.45
8.1.80.0040.00417.55
8.1.70.0040.00417.53
8.1.60.0060.00317.54
8.1.50.0030.00617.63
8.1.40.0060.00317.60
8.1.30.0050.00317.77
8.1.20.0100.00017.74
8.1.10.0040.00417.57
8.1.00.0030.00617.66
8.0.300.0000.00720.21
8.0.290.0080.00016.88
8.0.280.0070.00018.55
8.0.270.0070.00317.36
8.0.260.0000.00717.05
8.0.250.0040.00417.14
8.0.240.0000.00717.16
8.0.230.0060.00317.01
8.0.220.0000.00816.95
8.0.210.0030.00317.05
8.0.200.0000.00617.16
8.0.190.0030.00616.98
8.0.180.0050.00317.14
8.0.170.0000.00816.97
8.0.160.0050.00317.13
8.0.150.0070.00016.97
8.0.140.0030.00717.02
8.0.130.0070.00413.50
8.0.120.0030.00516.91
8.0.110.0040.00417.12
8.0.100.0040.00416.97
8.0.90.0040.00416.98
8.0.80.0160.00617.03
8.0.70.0000.00716.95
8.0.60.0000.00717.06
8.0.50.0020.00516.88
8.0.30.0130.00917.14
8.0.20.0140.00617.40
8.0.10.0040.00417.03
8.0.00.0110.00916.86
7.4.330.0020.00215.08
7.4.320.0000.00616.57
7.4.300.0060.00016.55
7.4.290.0000.00816.66
7.4.280.0040.00416.64
7.4.270.0040.00416.54
7.4.260.0000.00816.55
7.4.250.0070.00016.64
7.4.240.0040.00416.65
7.4.230.0000.00816.58
7.4.220.0070.01116.52
7.4.210.0060.01116.66
7.4.200.0040.00416.63
7.4.160.0100.00716.49
7.4.150.0050.01417.40
7.4.140.0110.01117.86
7.4.130.0140.00516.59
7.4.120.0110.00716.66
7.4.110.0140.00316.58
7.4.100.0090.00916.56
7.4.90.0140.00316.64
7.4.80.0130.01319.39
7.4.70.0040.01216.54
7.4.60.0180.00016.41
7.4.50.0030.01416.73
7.4.40.0120.00416.27
7.4.30.0060.01216.48
7.4.00.0040.01115.04
7.3.330.0040.00413.11
7.3.320.0030.00313.23
7.3.310.0000.00816.41
7.3.300.0040.00416.30
7.3.290.0090.01016.34
7.3.280.0100.01016.36
7.3.270.0080.01717.40
7.3.260.0060.01716.37
7.3.250.0120.00816.53
7.3.240.0080.01216.48
7.3.230.0030.01516.39
7.3.210.0080.00816.41
7.3.200.0070.01019.39
7.3.190.0120.00616.33
7.3.180.0040.01316.44
7.3.170.0120.00616.53
7.3.160.0140.00316.38
7.3.00.0150.00316.40
7.2.330.0110.01216.64
7.2.320.0180.00416.79
7.2.310.0090.00916.53
7.2.300.0090.00916.73
7.2.290.0100.00616.61
7.2.130.0100.01016.20
7.2.120.0070.01016.77
7.2.110.0100.00716.52
7.2.100.0090.00916.04
7.2.90.0100.00616.86
7.2.80.0130.00616.46
7.2.70.0090.00616.66
7.2.60.0040.01116.73
7.2.50.0130.00316.63
7.2.40.0120.00616.88
7.2.30.0120.00616.88
7.2.20.0140.00416.73
7.2.10.0070.00716.89
7.2.00.0020.01318.13
7.1.250.0130.00515.44
7.1.240.0110.00615.58
7.1.230.0060.01315.60
7.1.220.0110.00715.68
7.1.210.0190.00015.33
7.1.200.0050.00615.40
7.1.190.0140.00515.58
7.1.180.0100.00715.68
7.1.170.0070.01015.60
7.1.160.0070.00715.76
7.1.150.0140.00315.48
7.1.140.0100.00715.43
7.1.130.0090.00615.87
7.1.120.0080.00415.64
7.1.110.0090.00915.62
7.1.100.0300.00715.81
7.1.90.0100.00715.61
7.1.80.0100.00715.94
7.1.70.0090.00316.29
7.1.60.0120.00817.51
7.1.50.0090.00716.21
7.1.40.0090.00915.75
7.1.30.0080.00815.64
7.1.20.0130.00715.71
7.1.10.0100.00715.78
7.1.00.0030.04318.96
7.0.330.0150.00315.17
7.0.320.0060.01315.15
7.0.310.0110.00714.98
7.0.300.0090.00615.18
7.0.290.0060.01015.30
7.0.280.0100.00615.49
7.0.270.0090.00315.21
7.0.260.0090.00915.42
7.0.250.0110.00415.33
7.0.240.0040.01115.07
7.0.230.0040.01115.32
7.0.220.0070.00715.12
7.0.210.0130.00014.93
7.0.200.0070.00715.01
7.0.190.0130.00015.49
7.0.180.0080.00315.29
7.0.170.0100.01015.40
7.0.160.0030.01015.00
7.0.150.0060.00915.16
7.0.140.0100.01015.24
7.0.130.0070.00715.20
7.0.120.0100.00715.14
7.0.110.0040.00714.79
7.0.100.0030.01214.84
7.0.90.0040.01515.13
7.0.80.0060.00614.72
7.0.70.0130.00615.25
7.0.60.0150.04717.50
7.0.50.0180.03117.71
7.0.40.0170.03116.78
7.0.30.0180.03216.82
7.0.20.0220.02916.77
7.0.10.0150.03216.71
7.0.00.0230.02616.55
5.6.380.0110.00414.07
5.6.370.0090.00814.19
5.6.360.0100.01014.28
5.6.350.0140.00414.40
5.6.340.0040.01314.27
5.6.330.0090.00714.29
5.6.320.0020.00914.30
5.6.310.0040.00813.91
5.6.300.0080.00813.72
5.6.290.0090.00614.28
5.6.280.0070.03917.47
5.6.270.0060.00613.91
5.6.260.0060.01013.93
5.6.250.0040.00814.35
5.6.240.0060.00914.19
5.6.230.0070.00414.18
5.6.220.0060.00914.10
5.6.210.0050.04417.46
5.6.200.0090.03517.67
5.6.190.0100.03417.64
5.6.180.0160.03317.72
5.6.170.0180.03017.41
5.6.160.0200.03217.52
5.6.150.0150.03517.48
5.6.140.0180.02517.49
5.6.130.0090.03317.71
5.6.120.0170.03017.68
5.6.110.0140.03617.69
5.6.100.0200.03917.68
5.6.90.0260.02717.57
5.6.80.0100.03717.21
5.6.70.0160.03317.25
5.6.60.0150.03317.26
5.6.50.0180.02917.30
5.6.40.0120.04517.38
5.6.30.0230.02917.25
5.6.20.0170.03217.27
5.6.10.0230.02817.32
5.6.00.0200.02817.28
5.5.380.0140.00610.90
5.5.370.0160.00311.01
5.5.360.0130.00310.94
5.5.350.0190.03315.75
5.5.340.0130.03016.02
5.5.330.0070.03416.03
5.5.320.0190.03215.95
5.5.310.0210.03115.92
5.5.300.0130.03915.90
5.5.290.0170.03315.80
5.5.280.0140.03316.00
5.5.270.0170.03415.90
5.5.260.0200.03215.98
5.5.250.0240.02615.71
5.5.240.0230.02215.57
5.5.230.0100.03815.57
5.5.220.0200.02415.54
5.5.210.0200.03015.57
5.5.200.0230.02415.56
5.5.190.0200.03915.55
5.5.180.0180.03215.57
5.5.170.0000.00910.90
5.5.160.0190.02815.70
5.5.150.0110.03515.62
5.5.140.0180.03015.56
5.5.130.0240.02915.69
5.5.120.0220.02815.67
5.5.110.0170.02615.57
5.5.100.0060.03415.60
5.5.90.0130.03115.59
5.5.80.0150.03015.62
5.5.70.0110.03015.60
5.5.60.0170.02315.51
5.5.50.0100.03015.55
5.5.40.0200.02815.55
5.5.30.0230.02615.58
5.5.20.0180.03015.50
5.5.10.0190.03115.50
5.5.00.0160.03415.62

preferences:
60.3 ms | 401 KiB | 5 Q