3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Outside of the application, e.g. DB, RPC or some storage. function addSomeIntegerFieldToDB($value) { $sql = 'INSERT INTO mytable (integer_field) VALUES (:int)'; // $st = $pdo->prepare($sql); // $st->execute(array('int' => $value); echo "executing query: ".str_replace(':int', $value, $sql)." \n"; } // the application: global $conditional; global $withAssert; class X { public function doSmth($id) { global $conditional; global $withAssert; if ($withAssert) { // Assertion will run outside of the if/else below // Preventing a wrong $id to be passed to ->doSmth() method, independent of the $conditional assert(is_int($id), new \InvalidArgumentException('wot ar y doin')); } if ($conditional) { addSomeIntegerFieldToDB($id); } } } $obj = new X; // Assert on, conditional on $withAssert = true; $conditional = true; $obj->doSmth(13); $obj->doSmth('x'); // Assert on, conditional off $conditional = false; $obj->doSmth(13); $obj->doSmth('x'); $withAssert = false; $conditional = true; // Assert off, conditional on $obj->doSmth(13); $obj->doSmth('x'); // Assert off, conditional off $conditional = false; $obj->doSmth(13); $obj->doSmth('x');

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.0040.01518.55
8.3.50.0070.00718.26
8.3.40.0080.00818.97
8.3.30.0120.00318.71
8.3.20.0000.00720.33
8.3.10.0050.00320.66
8.3.00.0040.00423.48
8.2.180.0140.00016.50
8.2.170.0120.00922.96
8.2.160.0130.00322.25
8.2.150.0060.00324.18
8.2.140.0100.00024.66
8.2.130.0040.00420.92
8.2.120.0040.00426.35
8.2.110.0070.00319.37
8.2.100.0090.00317.72
8.2.90.0040.00419.17
8.2.80.0080.00017.97
8.2.70.0040.00417.63
8.2.60.0000.00817.93
8.2.50.0030.00618.09
8.2.40.0060.00322.27
8.2.30.0000.00719.57
8.2.20.0070.00017.92
8.2.10.0040.00418.26
8.2.00.0080.00018.25
8.1.280.0070.00725.92
8.1.270.0040.00422.31
8.1.260.0030.00628.09
8.1.250.0040.00428.09
8.1.240.0030.00723.86
8.1.230.0030.00720.95
8.1.220.0090.00017.91
8.1.210.0000.00818.77
8.1.200.0040.00417.36
8.1.190.0040.00417.35
8.1.180.0030.00618.10
8.1.170.0030.00518.37
8.1.160.0000.00820.81
8.1.150.0040.00420.66
8.1.140.0030.00619.50
8.1.130.0080.00017.75
8.1.120.0000.00717.42
8.1.110.0000.00717.50
8.1.100.0000.00717.56
8.1.90.0040.00417.46
8.1.80.0040.00417.56
8.1.70.0000.00717.47
8.1.60.0040.00417.65
8.1.50.0000.00817.59
8.1.40.0080.00017.59
8.1.30.0050.00317.64
8.1.20.0040.00417.51
8.1.10.0030.00517.54
8.1.00.0030.00917.57
8.0.300.0020.00518.77
8.0.290.0050.00316.75
8.0.280.0000.00818.51
8.0.270.0000.00717.22
8.0.260.0000.00617.31
8.0.250.0070.00017.04
8.0.240.0030.00316.94
8.0.230.0000.00717.08
8.0.220.0080.00016.84
8.0.210.0000.00716.86
8.0.200.0040.00417.10
8.0.190.0000.00816.96
8.0.180.0070.00016.91
8.0.170.0030.00617.02
8.0.160.0050.00216.92
8.0.150.0030.00516.99
8.0.140.0040.00416.93
8.0.130.0000.00613.31
8.0.120.0030.00516.88
8.0.110.0070.00016.95
8.0.100.0000.00916.87
8.0.90.0000.00917.07
8.0.80.0130.00317.07
8.0.70.0030.00517.10
8.0.60.0000.00716.77
8.0.50.0000.00716.79
8.0.30.0050.01117.16
8.0.20.0120.00917.40
8.0.10.0040.00417.03
8.0.00.0060.01116.94
7.4.330.0000.00516.70
7.4.320.0030.00316.54
7.4.300.0030.00316.56
7.4.290.0000.00716.55
7.4.280.0040.00416.62
7.4.270.0040.00416.58
7.4.260.0030.00516.52
7.4.250.0060.00316.50
7.4.240.0000.00716.48
7.4.230.0070.00016.63
7.4.220.0060.01316.68
7.4.210.0110.00516.61
7.4.200.0000.00716.53
7.4.160.0110.00716.62
7.4.150.0120.00617.40
7.4.140.0140.00717.86
7.4.130.0100.00916.62
7.4.120.0050.01216.57
7.4.110.0100.00716.62
7.4.100.0100.01016.66
7.4.90.0150.00316.55
7.4.80.0240.00019.39
7.4.70.0140.01116.71
7.4.60.0090.00616.56
7.4.50.0050.00516.57
7.4.40.0070.01116.54
7.4.30.0130.01016.73
7.4.00.0140.00415.30
7.3.330.0030.00313.48
7.3.320.0000.00713.41
7.3.310.0040.00416.39
7.3.300.0000.00716.41
7.3.290.0070.00016.40
7.3.280.0090.01016.42
7.3.270.0090.00917.40
7.3.260.0110.00516.65
7.3.250.0070.01016.50
7.3.240.0080.00816.35
7.3.230.0170.00016.54
7.3.210.0170.00316.54
7.3.200.0100.01316.63
7.3.190.0070.01516.43
7.3.180.0120.00616.54
7.3.170.0100.00716.56
7.3.160.0110.00716.38
7.3.10.0120.00316.29
7.3.00.0080.00816.73
7.2.330.0120.00616.89
7.2.320.0090.00916.78
7.2.310.0140.00616.47
7.2.300.0160.00616.81
7.2.290.0070.01016.84
7.2.130.0070.01016.70
7.2.120.0110.00616.65
7.2.110.0090.01016.52
7.2.100.0130.00516.71
7.2.90.0110.00417.06
7.2.80.0070.00916.82
7.2.70.0050.01116.98
7.2.60.0060.01016.77
7.2.50.0120.00616.94
7.2.40.0040.00916.74
7.2.30.0080.00816.85
7.2.20.0090.00816.66
7.2.10.0080.01016.78
7.2.00.0070.00917.67
7.1.250.0130.00415.74
7.1.200.0000.01215.62
7.1.100.0030.00618.41
7.1.70.0040.00417.38
7.1.60.0030.02319.19
7.1.50.0140.00717.10
7.1.00.0130.06722.44
7.0.200.0300.00014.57
7.0.60.0170.04719.93
7.0.50.0100.08017.93
7.0.40.0130.04720.24
7.0.30.0370.07720.36
7.0.20.0300.06720.12
7.0.10.0070.08320.33
7.0.00.0170.05320.07
5.6.280.0000.03320.87
5.6.210.0130.08020.51
5.6.200.0100.08018.27
5.6.190.0100.08020.52
5.6.180.0370.07020.55
5.6.170.0230.07020.61
5.6.160.0170.07320.62
5.6.150.0130.04718.16
5.6.140.0070.07718.14
5.6.130.0100.05018.29
5.6.120.0030.08721.04
5.6.110.0100.08020.99
5.6.100.0100.07321.00
5.6.90.0070.05020.95
5.6.80.0030.05020.52
5.5.350.4200.04320.34
5.5.340.0100.08317.99
5.5.330.0000.04320.35
5.5.320.0500.04320.35
5.5.310.0330.08020.35
5.5.300.0130.07318.01
5.5.290.0030.04018.06
5.5.280.0130.07320.89
5.5.270.0030.06720.77
5.5.260.0100.08020.87
5.5.250.0100.06020.59
5.5.240.0130.04320.08

preferences:
38.36 ms | 400 KiB | 5 Q