3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Outside of the application, e.g. DB 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.0140.00718.43
8.3.50.0120.00821.98
8.3.40.0120.00318.75
8.3.30.0070.00718.67
8.3.20.0080.00020.36
8.3.10.0050.00520.66
8.3.00.0040.00423.52
8.2.180.0110.00716.63
8.2.170.0080.00822.96
8.2.160.0030.01022.15
8.2.150.0080.00024.18
8.2.140.0040.00724.66
8.2.130.0030.00520.94
8.2.120.0070.00026.35
8.2.110.0180.00321.08
8.2.100.0080.00417.93
8.2.90.0000.00819.16
8.2.80.0060.00317.97
8.2.70.0080.00017.50
8.2.60.0060.00317.93
8.2.50.0040.00418.09
8.2.40.0030.00622.27
8.2.30.0000.00719.50
8.2.20.0070.00017.75
8.2.10.0000.00818.12
8.2.00.0000.00718.15
8.1.280.0110.00325.92
8.1.270.0070.01122.26
8.1.260.0030.00628.09
8.1.250.0030.00528.09
8.1.240.0030.00619.19
8.1.230.0000.01121.11
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0060.00317.25
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0040.00418.53
8.1.160.0040.00420.82
8.1.150.0060.00320.62
8.1.140.0080.00019.55
8.1.130.0030.00517.63
8.1.120.0040.00417.43
8.1.110.0040.00417.55
8.1.100.0050.00217.55
8.1.90.0000.00717.50
8.1.80.0040.00417.51
8.1.70.0030.00317.40
8.1.60.0020.00517.70
8.1.50.0050.00317.57
8.1.40.0080.00017.50
8.1.30.0000.00817.56
8.1.20.0050.00317.45
8.1.10.0070.00017.64
8.1.00.0060.00717.54
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0000.00818.56
8.0.270.0040.00417.32
8.0.260.0070.00017.19
8.0.250.0070.00017.07
8.0.240.0000.00717.06
8.0.230.0000.00716.97
8.0.220.0000.00816.91
8.0.210.0080.00017.03
8.0.200.0030.00317.03
8.0.190.0030.00617.11
8.0.180.0050.00317.04
8.0.170.0040.00417.06
8.0.160.0030.00317.09
8.0.150.0000.00817.05
8.0.140.0050.00216.87
8.0.130.0060.00013.40
8.0.120.0030.00517.00
8.0.110.0050.00216.98
8.0.100.0040.00416.88
8.0.90.0000.00716.83
8.0.80.0000.01517.05
8.0.70.0040.00417.05
8.0.60.0020.00516.89
8.0.50.0040.00416.88
8.0.30.0050.01117.14
8.0.20.0110.01017.40
8.0.10.0040.00417.06
8.0.00.0100.00716.88
7.4.330.0050.00016.83
7.4.320.0030.00316.42
7.4.300.0030.00316.64
7.4.290.0070.00016.66
7.4.280.0030.00716.58
7.4.270.0030.00316.58
7.4.260.0000.00816.65
7.4.250.0000.00916.58
7.4.240.0030.00316.63
7.4.230.0000.00716.63
7.4.220.0120.00616.52
7.4.210.0040.01116.65
7.4.200.0000.00716.47
7.4.160.0160.00316.85
7.4.150.0000.01817.40
7.4.140.0120.01017.86
7.4.130.0060.01516.56
7.4.120.0090.00916.67
7.4.110.0120.00416.53
7.4.100.0120.00616.54
7.4.90.0170.00016.61
7.4.80.0070.01019.39
7.4.70.0080.00816.65
7.4.60.0110.00516.70
7.4.50.0090.00616.66
7.4.40.0070.01016.77
7.4.30.0130.00716.45
7.4.00.0070.01114.89
7.3.330.0030.00313.21
7.3.320.0030.00313.26
7.3.310.0040.00416.30
7.3.300.0030.00316.28
7.3.290.0030.00316.36
7.3.280.0100.00516.43
7.3.270.0100.00717.40
7.3.260.0110.00516.43
7.3.250.0110.00916.51
7.3.240.0110.00616.37
7.3.230.0090.01216.39
7.3.210.0100.01016.39
7.3.200.0080.01516.59
7.3.190.0000.02116.37
7.3.180.0200.00416.68
7.3.170.0170.00016.57
7.3.160.0080.00816.48
7.3.10.0140.00316.18
7.3.00.0110.00416.25
7.2.330.0150.00316.85
7.2.320.0110.00716.80
7.2.310.0090.01316.43
7.2.300.0080.00916.61
7.2.290.0030.01316.61
7.2.130.0130.00616.36
7.2.120.0220.00016.95
7.2.110.0090.00816.50
7.2.100.0140.00816.85
7.2.90.0130.00916.75
7.2.80.0300.00616.81
7.2.70.0190.00916.24
7.2.60.0140.00916.61
7.2.50.0120.00916.48
7.2.40.0290.00716.96
7.2.30.0100.01016.27
7.2.20.0040.01216.26
7.2.10.0150.00516.28
7.2.00.0070.00818.22
7.1.250.0090.00915.23
7.1.200.0070.00715.92
7.1.100.0090.00318.04
7.1.70.0000.00816.93
7.1.60.0130.01319.19
7.1.50.0080.00317.02
7.1.00.0030.07322.46
7.0.200.0410.00714.94
7.0.60.0330.07321.70
7.0.50.0170.05017.87
7.0.40.0130.06320.40
7.0.30.0330.07320.06
7.0.20.0270.05720.24
7.0.10.0030.06020.15
7.0.00.0170.06020.07
5.6.280.0030.07321.13
5.6.210.0100.08020.51
5.6.200.0070.05318.12
5.6.190.0030.09320.41
5.6.180.0400.07720.47
5.6.170.0270.06320.56
5.6.160.0130.07020.54
5.6.150.0070.07318.19
5.6.140.0070.08318.18
5.6.130.0100.03718.15
5.6.120.0200.07321.06
5.6.110.0200.06721.00
5.6.100.0100.06021.11
5.6.90.0070.08320.97
5.6.80.0100.04320.40
5.5.350.3070.04720.43
5.5.340.0100.05717.94
5.5.330.0070.03720.13
5.5.320.0270.06320.34
5.5.310.0170.08720.29
5.5.300.0070.04317.98
5.5.290.0030.04017.94
5.5.280.0030.05720.97
5.5.270.0100.06020.80
5.5.260.0000.09720.88
5.5.250.0200.07020.70
5.5.240.0070.04720.17

preferences:
55.21 ms | 404 KiB | 6 Q