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 off $withAssert = true; $conditional = false; $obj->doSmth(13); $obj->doSmth('x'); // Assert on, conditional on $conditional = true; $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.39
8.3.50.0120.00721.98
8.3.40.0060.00918.96
8.3.30.0080.00818.87
8.3.20.0080.00020.34
8.3.10.0060.00320.63
8.3.00.0040.00423.48
8.2.180.0070.00716.88
8.2.170.0140.00322.96
8.2.160.0110.00422.13
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0070.00320.93
8.2.100.0040.00717.91
8.2.90.0030.00618.03
8.2.80.0030.00618.34
8.2.70.0050.00317.63
8.2.60.0080.00017.63
8.2.50.0000.00918.09
8.2.40.0040.00422.08
8.2.30.0050.00219.39
8.2.20.0050.00317.86
8.2.10.0040.00418.25
8.2.00.0000.00818.23
8.1.280.0090.00625.92
8.1.270.0050.00322.23
8.1.260.0070.00326.35
8.1.250.0050.00328.09
8.1.240.0060.00322.50
8.1.230.0000.01122.36
8.1.220.0080.00017.79
8.1.210.0000.00818.80
8.1.200.0060.00317.48
8.1.190.0040.00418.93
8.1.180.0040.00418.10
8.1.170.0000.00818.62
8.1.160.0060.00320.86
8.1.150.0000.00718.94
8.1.140.0080.00019.68
8.1.130.0050.00217.81
8.1.120.0040.00417.56
8.1.110.0050.00217.46
8.1.100.0040.00417.41
8.1.90.0030.00617.53
8.1.80.0040.00417.52
8.1.70.0030.00517.48
8.1.60.0030.00517.66
8.1.50.0030.00517.48
8.1.40.0000.00817.62
8.1.30.0030.00517.55
8.1.20.0030.00517.57
8.1.10.0030.00617.67
8.1.00.0000.01017.50
8.0.300.0000.00720.11
8.0.290.0080.00016.88
8.0.280.0050.00318.38
8.0.270.0000.00817.31
8.0.260.0000.00717.30
8.0.250.0030.00317.02
8.0.240.0000.00817.08
8.0.230.0030.00316.96
8.0.220.0000.00716.91
8.0.210.0000.00716.90
8.0.200.0030.00317.06
8.0.190.0040.00417.10
8.0.180.0000.00716.93
8.0.170.0050.00317.06
8.0.160.0070.00016.99
8.0.150.0040.00416.87
8.0.140.0030.00616.97
8.0.130.0030.00313.45
8.0.120.0040.00417.04
8.0.110.0060.00316.90
8.0.100.0040.00416.91
8.0.90.0040.00417.09
8.0.80.0070.01016.89
8.0.70.0040.00416.84
8.0.60.0070.00016.87
8.0.50.0040.00416.78
8.0.30.0090.01017.33
8.0.20.0140.00417.40
8.0.10.0030.00517.09
8.0.00.0080.00916.84
7.4.330.0030.00316.66
7.4.320.0000.00716.52
7.4.300.0000.00616.71
7.4.290.0030.00316.42
7.4.280.0050.00216.70
7.4.270.0000.00716.65
7.4.260.0090.00016.67
7.4.250.0030.00616.54
7.4.240.0040.00416.71
7.4.230.0070.00016.56
7.4.220.0080.01116.52
7.4.210.0080.00716.70
7.4.200.0030.00316.76
7.4.160.0110.00516.81
7.4.150.0080.01117.40
7.4.140.0140.00517.86
7.4.130.0110.01016.62
7.4.120.0090.00816.66
7.4.110.0080.00816.61
7.4.100.0130.00716.70
7.4.90.0140.00316.43
7.4.80.0100.00719.39
7.4.70.0060.01216.63
7.4.60.0030.01416.50
7.4.50.0080.00816.69
7.4.40.0120.01216.70
7.4.30.0130.00716.78
7.4.10.0070.01114.89
7.4.00.0090.00714.95
7.3.330.0030.00313.23
7.3.320.0000.00613.39
7.3.310.0000.00716.31
7.3.300.0030.00316.39
7.3.290.0070.00016.27
7.3.280.0080.00916.36
7.3.270.0140.00317.40
7.3.260.0220.00316.59
7.3.250.0130.00516.50
7.3.240.0130.00416.54
7.3.230.0130.00316.45
7.3.210.0090.00916.57
7.3.200.0100.01316.47
7.3.190.0070.01016.48
7.3.180.0090.01216.45
7.3.170.0120.00616.48
7.3.160.0140.00316.62
7.3.130.0090.00915.00
7.3.120.0060.01215.07
7.3.110.0030.01315.02
7.3.100.0000.01714.99
7.3.90.0030.00914.98
7.3.80.0110.00315.00
7.3.70.0120.00014.94
7.3.60.0120.00314.75
7.3.50.0000.01714.90
7.3.40.0030.00714.70
7.3.30.0000.01414.86
7.3.20.0080.00816.74
7.3.10.0090.00616.69
7.3.00.0030.01016.71
7.2.330.0070.01616.80
7.2.320.0060.01216.72
7.2.310.0130.01016.90
7.2.300.0130.00716.88
7.2.290.0110.00516.72
7.2.260.0150.00314.77
7.2.250.0060.01015.09
7.2.240.0060.01215.35
7.2.230.0040.01114.91
7.2.220.0090.00915.27
7.2.210.0040.00914.91
7.2.200.0030.01015.29
7.2.190.0030.01214.71
7.2.180.0100.00615.05
7.2.170.0030.01014.99
7.2.160.0000.01215.24
7.2.150.0130.00316.95
7.2.140.0080.00316.92
7.2.130.0040.00816.66
7.2.120.0060.00616.73
7.2.110.0000.01516.92
7.2.100.0070.00717.00
7.2.90.0080.00316.82
7.2.80.0090.00616.87
7.2.70.0030.01016.88
7.2.60.0070.00816.85
7.2.50.0070.00716.82
7.2.40.0030.01216.74
7.2.30.0000.01117.02
7.2.20.0030.01416.95
7.2.10.0000.01217.09
7.2.00.0070.00618.07
7.1.330.0030.01015.57
7.1.320.0080.00615.77
7.1.310.0040.01115.79
7.1.300.0000.01615.88
7.1.290.0080.00415.81
7.1.280.0000.01215.89
7.1.270.0090.00315.74
7.1.260.0040.00415.81
7.1.250.0030.00615.55
7.1.240.0130.00015.84
7.1.230.0000.00915.81
7.1.220.0080.00015.73
7.1.210.0000.01115.95
7.1.200.0050.00615.69
7.1.190.0030.00715.73
7.1.180.0070.00315.86
7.1.170.0030.00715.56
7.1.160.0060.00815.75
7.1.150.0030.01115.73
7.1.140.0100.00315.61
7.1.130.0060.00615.82
7.1.120.0030.00615.54
7.1.110.0040.01115.79
7.1.100.0070.00517.21
7.1.90.0000.01115.76
7.1.80.0090.00015.96
7.1.70.0040.00816.40
7.1.60.0040.01217.45
7.1.50.0090.00516.36
7.1.40.0120.00415.69
7.1.30.0040.00415.98
7.1.20.0070.00715.68
7.1.10.0030.01315.72
7.1.00.0100.03619.08
7.0.330.0090.00615.13
7.0.320.0070.00315.36
7.0.310.0050.00315.45
7.0.300.0000.01615.38
7.0.290.0040.01015.44
7.0.280.0040.00815.41
7.0.270.0050.00515.18
7.0.260.0100.00315.37
7.0.250.0080.00315.63
7.0.240.0060.00315.23
7.0.230.0030.00715.64
7.0.220.0070.00715.28
7.0.210.0060.00315.41
7.0.200.0200.00615.15
7.0.190.0030.00915.55
7.0.180.0030.01015.51
7.0.170.0110.00015.29
7.0.160.0030.00615.46
7.0.150.0030.00815.46
7.0.140.0040.00815.48
7.0.130.0040.00415.23
7.0.120.0070.00715.20
7.0.110.0110.00715.59
7.0.100.0040.01315.51
7.0.90.0100.01015.36
7.0.80.0040.01115.60
7.0.70.0110.00015.35
7.0.60.0120.04218.65
7.0.50.0030.04616.71
7.0.40.0030.04816.86
7.0.30.0130.02116.80
7.0.20.0170.03416.85
7.0.10.0080.04216.83
7.0.00.0090.02216.68
5.6.400.0040.00814.26
5.6.390.0120.00014.53
5.6.380.0060.00614.46
5.6.370.0040.01114.15
5.6.360.0030.01414.34
5.6.350.0050.00314.29
5.6.340.0070.00714.59
5.6.330.0070.00714.36
5.6.320.0060.00614.27
5.6.310.0140.00014.30
5.6.300.0030.01014.17
5.6.290.0030.00614.16
5.6.280.0020.02117.65
5.6.270.0040.01214.03
5.6.260.0070.01114.17
5.6.250.0030.01114.25
5.6.240.0060.01014.29
5.6.230.0030.01514.67
5.6.220.0030.00813.95
5.6.210.0080.02817.47
5.6.200.0130.03816.20
5.6.190.0110.04317.45
5.6.180.0100.02917.40
5.6.170.0130.04017.34
5.6.160.0070.04517.38
5.6.150.0020.04416.20
5.6.140.0070.04216.36
5.6.130.0070.02816.36
5.6.120.0070.03817.73
5.6.110.0090.04017.56
5.6.100.0040.03517.79
5.6.90.0060.04017.61
5.6.80.0100.03217.45
5.6.70.0000.01014.47
5.6.60.0130.00014.10
5.6.50.0070.00314.21
5.6.40.0090.00614.33
5.6.30.0070.00314.16
5.6.20.0040.00414.23
5.6.10.0040.00714.30
5.6.00.0040.00814.21
5.5.380.0030.01014.11
5.5.370.0070.01014.29
5.5.360.0060.00614.14
5.5.350.1380.01617.42
5.5.340.0090.02316.10
5.5.330.0070.02517.27
5.5.320.0150.02217.34
5.5.310.0120.04517.24
5.5.300.0070.04216.15
5.5.290.0070.02216.13
5.5.280.0070.04617.61
5.5.270.0020.03717.67
5.5.260.0080.04117.73
5.5.250.0030.04517.52
5.5.240.0170.03917.40
5.5.230.0040.00714.44
5.5.220.0030.00913.98
5.5.210.0030.00614.06
5.5.200.0090.00614.08
5.5.190.0080.00414.11
5.5.180.0100.00614.12
5.5.170.0140.00014.40
5.5.160.0070.00714.21
5.5.150.0100.00314.44
5.5.140.0030.00613.80
5.5.130.0040.00414.06
5.5.120.0030.00613.92
5.5.110.0060.00614.24
5.5.100.0040.00414.48
5.5.90.0000.00814.23
5.5.80.0030.01214.38
5.5.70.0060.00914.31
5.5.60.0030.01014.19
5.5.50.0060.01014.23
5.5.40.0030.01014.17
5.5.30.0070.00313.80
5.5.20.0040.00414.23
5.5.10.0030.00613.96
5.5.00.0120.00314.16

preferences:
55.21 ms | 401 KiB | 5 Q