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 independently of $conditional, thus preventing a wrong $id to be passed to ->doSmth() method assert(is_int($id), new \InvalidArgumentException('wot ar y doin')); } if ($conditional) { addSomeIntegerFieldToDB($id); } } } $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.0060.01518.56
8.3.50.0170.00222.05
8.3.40.0080.00818.80
8.3.30.0040.01118.70
8.3.20.0040.00420.34
8.3.10.0040.00420.61
8.3.00.0040.00423.68
8.2.180.0070.00716.63
8.2.170.0090.00622.96
8.2.160.0070.01022.11
8.2.150.0050.00324.18
8.2.140.0070.00424.66
8.2.130.0040.00420.86
8.2.120.0040.00426.35
8.2.110.0060.00320.86
8.2.100.0110.00017.93
8.2.90.0050.00319.13
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0030.00517.93
8.2.50.0000.00918.09
8.2.40.0090.00022.14
8.2.30.0040.00419.57
8.2.20.0000.00717.80
8.2.10.0000.00718.25
8.2.00.0050.00318.24
8.1.280.0060.00925.92
8.1.270.0090.00922.32
8.1.260.0030.00628.09
8.1.250.0000.00728.09
8.1.240.0030.00622.53
8.1.230.0110.00417.70
8.1.220.0040.00417.74
8.1.210.0050.00518.77
8.1.200.0050.00517.48
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0060.00318.64
8.1.160.0040.00420.81
8.1.150.0040.00420.67
8.1.140.0000.00819.55
8.1.130.0030.00317.79
8.1.120.0000.00717.57
8.1.110.0080.00017.47
8.1.100.0070.00017.44
8.1.90.0040.00417.55
8.1.80.0040.00417.40
8.1.70.0000.00717.53
8.1.60.0060.00317.69
8.1.50.0040.00417.63
8.1.40.0040.00417.55
8.1.30.0000.00817.73
8.1.20.0000.00717.43
8.1.10.0040.00417.60
8.1.00.0030.00717.53
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0000.00818.45
8.0.270.0050.00217.35
8.0.260.0070.00017.23
8.0.250.0040.00417.07
8.0.240.0030.00617.09
8.0.230.0000.00716.94
8.0.220.0040.00417.07
8.0.210.0030.00316.87
8.0.200.0000.00717.11
8.0.190.0000.00917.13
8.0.180.0040.00416.96
8.0.170.0060.00316.98
8.0.160.0050.00316.96
8.0.150.0030.00516.99
8.0.140.0000.00816.84
8.0.130.0000.00513.43
8.0.120.0050.00316.88
8.0.110.0080.00016.97
8.0.100.0040.00417.11
8.0.90.0040.00416.92
8.0.80.0130.00716.97
8.0.70.0040.00417.05
8.0.60.0040.00416.83
8.0.50.0070.00016.90
8.0.30.0110.00717.22
8.0.20.0140.00617.40
8.0.10.0050.00216.98
8.0.00.0070.01016.90
7.4.330.0000.00616.84
7.4.320.0060.00016.66
7.4.300.0030.00316.50
7.4.290.0070.00016.54
7.4.280.0070.00016.69
7.4.270.0030.00316.51
7.4.260.0040.00416.64
7.4.250.0040.00416.60
7.4.240.0000.00816.57
7.4.230.0070.00016.47
7.4.220.0120.00616.68
7.4.210.0070.01016.67
7.4.200.0050.00316.67
7.4.160.0100.01016.38
7.4.150.0120.00817.40
7.4.140.0080.01317.86
7.4.130.0120.00616.55
7.4.120.0130.00716.39
7.4.110.0120.00316.67
7.4.100.0090.00916.37
7.4.90.0150.00316.60
7.4.80.0070.01019.39
7.4.70.0050.01116.56
7.4.60.0060.01016.59
7.4.50.0000.01216.61
7.4.40.0080.00816.56
7.4.30.0070.01316.61
7.4.00.0060.00814.99
7.3.330.0000.00713.42
7.3.320.0030.00313.41
7.3.310.0000.00716.40
7.3.300.0030.00316.41
7.3.290.0000.00716.45
7.3.280.0090.00816.39
7.3.270.0140.00317.40
7.3.260.0110.00616.47
7.3.250.0120.01216.40
7.3.240.0120.00616.52
7.3.230.0090.00916.50
7.3.210.0030.01716.49
7.3.200.0040.01516.49
7.3.190.0090.01116.66
7.3.180.0050.01416.59
7.3.170.0130.00616.52
7.3.160.0110.00616.64
7.3.120.0070.01015.06
7.3.110.0040.01414.99
7.3.100.0070.00714.99
7.3.90.0040.00814.73
7.3.80.0080.00414.59
7.3.70.0000.00914.64
7.3.60.0130.00314.80
7.3.50.0100.00614.87
7.3.40.0070.01014.75
7.3.30.0070.00714.89
7.3.20.0070.00716.53
7.3.10.0060.00616.66
7.3.00.0050.00716.58
7.2.330.0080.01216.48
7.2.320.0030.01516.61
7.2.310.0140.00916.71
7.2.300.0100.01316.61
7.2.290.0140.00716.73
7.2.250.0040.01415.05
7.2.240.0070.01315.05
7.2.230.0090.00315.12
7.2.220.0030.01315.35
7.2.210.0090.00615.32
7.2.200.0140.00315.08
7.2.190.0060.00914.81
7.2.180.0060.00314.94
7.2.170.0060.00615.28
7.2.130.0080.00616.94
7.2.120.0090.00516.99
7.2.110.0070.00616.93
7.2.100.0050.00616.89
7.2.90.0080.00517.09
7.2.80.0040.00816.91
7.2.70.0040.00816.81
7.2.60.0040.00916.92
7.2.50.0020.00916.86
7.2.40.0060.00617.00
7.2.30.0040.00817.13
7.2.20.0040.00816.96
7.2.10.0090.00516.95
7.2.00.0050.00817.59
7.1.330.0110.00416.02
7.1.320.0110.00415.97
7.1.310.0030.01115.56
7.1.300.0040.01215.58
7.1.290.0030.01015.81
7.1.280.0040.01115.60
7.1.270.0030.01415.66
7.1.260.0030.01015.61
7.1.250.0040.00715.73
7.1.200.0080.00415.89
7.1.100.0070.00718.06
7.1.70.0030.00617.22
7.1.60.0090.01519.19
7.1.50.0070.01417.14
7.1.00.0070.07322.28
7.0.200.0460.00714.51
7.0.60.0200.07721.69
7.0.50.0030.04317.89
7.0.40.0100.08020.10
7.0.30.0230.04720.20
7.0.20.0300.07320.23
7.0.10.0100.05720.27
7.0.00.0130.07720.29
5.6.280.0030.03321.13
5.6.210.0070.07320.62
5.6.200.0030.08318.18
5.6.190.0170.07720.63
5.6.180.0300.04020.48
5.6.170.0230.07720.47
5.6.160.0070.04020.66
5.6.150.0100.08018.19
5.6.140.0030.04718.22
5.6.130.0070.04018.18
5.6.120.0070.06721.01
5.6.110.0100.07321.02
5.6.100.0070.08321.14
5.6.90.0000.07721.08
5.6.80.0100.07720.29
5.5.350.4270.04020.41
5.5.340.0100.07318.02
5.5.330.0030.04020.28
5.5.320.0630.06720.34
5.5.310.0300.07720.19
5.5.300.0000.04317.94
5.5.290.0100.03317.98
5.5.280.0000.08720.91
5.5.270.0070.06320.98
5.5.260.0130.07720.77
5.5.250.0130.08020.70
5.5.240.0230.03320.04

preferences:
72.43 ms | 401 KiB | 5 Q