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); } else { echo "Skipping a query with value of '".$id."'\n"; } } } $obj = new 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'); // 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');

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.0120.00618.42
8.3.50.0040.01118.05
8.3.40.0120.00318.84
8.3.30.0040.01118.71
8.3.20.0080.00020.29
8.3.10.0040.00420.61
8.3.00.0080.00023.66
8.2.180.0070.00718.20
8.2.170.0160.00022.96
8.2.160.0070.00722.14
8.2.150.0000.00824.18
8.2.140.0030.00624.66
8.2.130.0000.00820.86
8.2.120.0080.00026.35
8.2.110.0070.00319.27
8.2.100.0090.00317.80
8.2.90.0040.00419.09
8.2.80.0000.00817.97
8.2.70.0030.00617.36
8.2.60.0030.00517.93
8.2.50.0000.01018.09
8.2.40.0080.00022.14
8.2.30.0020.00519.50
8.2.20.0080.00017.81
8.2.10.0000.00718.10
8.2.00.0040.00418.13
8.1.280.0110.00425.92
8.1.270.0000.00821.96
8.1.260.0060.00328.09
8.1.250.0000.00828.09
8.1.240.0060.00322.65
8.1.230.0090.00317.52
8.1.220.0000.00817.77
8.1.210.0050.00318.77
8.1.200.0040.00717.48
8.1.190.0060.00317.35
8.1.180.0060.00318.10
8.1.170.0040.00418.84
8.1.160.0040.00420.72
8.1.150.0040.00418.99
8.1.140.0000.00819.63
8.1.130.0000.00717.68
8.1.120.0050.00317.53
8.1.110.0050.00317.55
8.1.100.0000.00717.53
8.1.90.0040.00417.55
8.1.80.0000.00717.55
8.1.70.0040.00417.50
8.1.60.0040.00417.65
8.1.50.0030.00517.53
8.1.40.0000.00817.59
8.1.30.0030.00617.79
8.1.20.0050.00317.44
8.1.10.0040.00417.65
8.1.00.0000.01117.57
8.0.300.0000.00918.77
8.0.290.0000.00716.88
8.0.280.0030.00318.47
8.0.270.0000.01017.23
8.0.260.0000.00817.19
8.0.250.0030.00317.14
8.0.240.0030.00317.12
8.0.230.0000.00716.94
8.0.220.0050.00317.00
8.0.210.0050.00216.90
8.0.200.0030.00317.11
8.0.190.0040.00416.97
8.0.180.0040.00416.95
8.0.170.0030.00616.95
8.0.160.0040.00417.03
8.0.150.0040.00417.01
8.0.140.0040.00417.00
8.0.130.0060.00013.48
8.0.120.0000.00816.88
8.0.110.0030.00617.01
8.0.100.0040.00416.91
8.0.90.0000.00716.90
8.0.80.0030.01617.02
8.0.70.0040.00416.80
8.0.60.0040.00416.93
8.0.50.0000.00716.92
8.0.30.0090.00817.23
8.0.20.0100.00917.40
8.0.10.0060.00317.02
8.0.00.0110.00616.80
7.4.330.0050.00016.74
7.4.320.0050.00216.48
7.4.300.0030.00316.51
7.4.290.0030.00316.68
7.4.280.0000.00816.55
7.4.270.0000.00716.55
7.4.260.0000.00816.69
7.4.250.0040.00416.64
7.4.240.0070.00016.67
7.4.230.0030.00316.73
7.4.220.0140.01416.69
7.4.210.0090.00816.68
7.4.200.0000.00716.66
7.4.160.0060.01016.54
7.4.150.0110.00717.40
7.4.140.0080.01717.86
7.4.130.0140.00416.48
7.4.120.0130.00516.79
7.4.110.0080.00816.63
7.4.100.0110.01116.58
7.4.90.0080.00916.39
7.4.80.0040.01319.39
7.4.70.0040.02016.53
7.4.60.0130.00416.66
7.4.50.0000.01716.70
7.4.40.0110.00716.53
7.4.30.0180.00316.70
7.4.00.0060.00915.00
7.3.330.0030.00313.48
7.3.320.0060.00013.46
7.3.310.0030.00316.41
7.3.300.0060.00016.33
7.3.290.0000.00716.28
7.3.280.0080.01016.41
7.3.270.0070.01117.40
7.3.260.0030.01516.49
7.3.250.0080.00916.47
7.3.240.0070.01116.61
7.3.230.0140.00416.61
7.3.210.0070.01416.44
7.3.200.0060.01216.50
7.3.190.0180.00316.60
7.3.180.0180.00516.60
7.3.170.0140.00316.62
7.3.160.0100.00616.46
7.3.120.0100.00614.97
7.3.110.0070.00414.99
7.3.100.0070.00714.96
7.3.90.0040.00714.58
7.3.80.0100.00014.76
7.3.70.0130.00314.61
7.3.60.0090.00314.78
7.3.50.0090.00614.68
7.3.40.0070.00714.64
7.3.30.0080.00814.72
7.3.20.0100.00616.45
7.3.10.0130.00016.65
7.3.00.0040.01116.55
7.2.330.0080.00816.62
7.2.320.0130.00416.51
7.2.310.0200.00016.82
7.2.300.0150.00316.91
7.2.290.0030.01316.74
7.2.240.0070.00315.36
7.2.230.0030.00714.96
7.2.220.0040.00715.30
7.2.210.0070.00715.03
7.2.200.0070.01115.00
7.2.190.0090.00615.07
7.2.180.0090.00615.11
7.2.170.0100.00715.06
7.2.160.0090.00615.09
7.2.150.0110.00716.96
7.2.140.0030.01416.91
7.2.130.0040.01116.92
7.2.120.0030.01317.05
7.2.110.0100.00316.90
7.2.100.0030.01016.99
7.2.90.0090.00616.97
7.2.80.0000.01717.00
7.2.70.0090.00916.84
7.2.60.0080.00716.87
7.2.50.0000.01016.89
7.2.40.0070.00716.88
7.2.30.0130.00316.78
7.2.20.0030.01017.11
7.2.10.0100.00616.67
7.2.00.0040.00917.99
7.1.330.0040.01116.05
7.1.320.0070.00715.88
7.1.310.0070.00315.57
7.1.300.0090.00315.77
7.1.290.0110.00416.02
7.1.280.0040.00815.49
7.1.270.0060.00615.80
7.1.260.0000.01415.86
7.1.250.0130.00315.71
7.1.200.0060.00915.93
7.1.100.0000.01118.26
7.1.70.0000.00817.37
7.1.60.0160.00919.19
7.1.50.0060.01316.69
7.1.00.0100.07022.45
7.0.200.0350.00714.87
7.0.60.0200.03319.96
7.0.50.0130.07317.98
7.0.40.0100.08020.02
7.0.30.0500.07020.07
7.0.20.0270.04720.12
7.0.10.0130.08320.07
7.0.00.0000.05320.05
5.6.280.0130.06020.93
5.6.210.0070.04020.48
5.6.200.0100.05718.19
5.6.190.0200.06720.67
5.6.180.0370.07320.46
5.6.170.0270.04720.48
5.6.160.0100.03720.53
5.6.150.0000.07018.18
5.6.140.0100.07718.18
5.6.130.0000.05018.18
5.6.120.0070.08321.14
5.6.110.0000.08321.04
5.6.100.0100.06321.13
5.6.90.0000.04321.11
5.6.80.0130.05720.29
5.5.350.4230.04020.42
5.5.340.0030.04717.99
5.5.330.0100.07020.35
5.5.320.0200.04720.20
5.5.310.0300.07720.26
5.5.300.0100.04317.97
5.5.290.0100.03317.93
5.5.280.0030.09020.69
5.5.270.0200.07720.77
5.5.260.0100.08020.80
5.5.250.0070.08320.71
5.5.240.0200.04720.06

preferences:
54.07 ms | 400 KiB | 5 Q