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; class X { public function doSmth($id) { // 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')); global $conditional; if ($conditional) { addSomeIntegerFieldToDB($id); } } } $conditional = true; $obj = new X; $obj->doSmth(13); $obj->doSmth('x'); $obj->doSmth(000001234000); $conditional = false; $obj->doSmth(13); $obj->doSmth('x'); $obj->doSmth(000001234000);

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.70.0070.00716.63
8.3.60.0060.01218.56
8.3.50.0110.00921.99
8.3.40.0040.01118.80
8.3.30.0060.00918.85
8.3.20.0080.00020.21
8.3.10.0080.00020.40
8.3.00.0040.00421.73
8.2.190.0070.00716.88
8.2.180.0060.00916.63
8.2.170.0110.00722.96
8.2.160.0100.00322.04
8.2.150.0080.00024.18
8.2.140.0100.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00419.89
8.2.110.0040.00421.05
8.2.100.0060.00618.22
8.2.90.0050.00319.26
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0030.00617.93
8.2.50.0040.00418.10
8.2.40.0080.00022.01
8.2.30.0040.00419.45
8.2.20.0000.00717.81
8.2.10.0050.00218.04
8.2.00.0050.00217.98
8.1.280.0150.00025.92
8.1.270.0000.00722.19
8.1.260.0040.00426.35
8.1.250.0110.00728.09
8.1.240.0070.00319.57
8.1.230.0120.00017.42
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0070.00317.35
8.1.190.0050.00317.35
8.1.180.0070.00018.10
8.1.170.0000.00818.55
8.1.160.0040.00420.79
8.1.150.0000.00820.64
8.1.140.0040.00419.49
8.1.130.0030.00320.02
8.1.120.0040.00417.49
8.1.110.0080.00017.38
8.1.100.0000.00717.36
8.1.90.0040.00417.40
8.1.80.0040.00417.30
8.1.70.0030.00317.36
8.1.60.0050.00317.60
8.1.50.0060.00317.52
8.1.40.0000.00817.41
8.1.30.0050.00317.55
8.1.20.0030.00617.46
8.1.10.0040.00417.54
8.1.00.0070.00317.58
8.0.300.0000.00718.77
8.0.290.0070.00016.63
8.0.280.0050.00218.39
8.0.270.0030.00317.27
8.0.260.0000.00721.91
8.0.250.0000.00717.05
8.0.240.0000.00717.02
8.0.230.0070.00017.02
8.0.220.0030.00316.96
8.0.210.0030.00316.97
8.0.200.0070.00017.09
8.0.190.0040.00416.92
8.0.180.0000.00717.00
8.0.170.0040.00417.00
8.0.160.0040.00416.83
8.0.150.0040.00416.95
8.0.140.0030.00316.93
8.0.130.0050.00013.42
8.0.120.0030.00616.89
8.0.110.0050.00316.87
8.0.100.0070.00016.74
8.0.90.0030.00416.94
8.0.80.0070.01116.98
8.0.70.0000.00716.93
8.0.60.0080.00016.79
8.0.50.0050.00216.77
8.0.30.0080.00817.06
8.0.20.0130.00917.40
8.0.10.0000.00716.98
8.0.00.0120.01216.84
7.4.330.0000.00616.89
7.4.320.0030.00316.31
7.4.300.0030.00316.61
7.4.290.0050.00316.59
7.4.280.0000.00916.56
7.4.270.0030.00316.54
7.4.260.0000.00716.63
7.4.250.0000.00816.56
7.4.240.0040.00416.60
7.4.230.0070.00016.39
7.4.220.0160.00316.52
7.4.210.0170.00316.66
7.4.200.0040.00416.59
7.4.160.0080.01116.77
7.4.150.0060.01217.40
7.4.140.0130.00617.86
7.4.130.0140.00716.55
7.4.120.0080.01116.58
7.4.110.0070.01016.42
7.4.100.0150.00316.59
7.4.90.0130.00416.34
7.4.80.0220.00019.39
7.4.70.0000.01716.38
7.4.60.0110.00516.60
7.4.50.0040.01116.36
7.4.40.0130.00416.57
7.4.30.0070.01516.58
7.4.00.0050.01015.06
7.3.330.0030.00213.23
7.3.320.0000.00613.35
7.3.310.0070.00016.43
7.3.300.0070.00016.31
7.3.290.0090.01016.38
7.3.280.0090.00916.35
7.3.270.0080.00817.40
7.3.260.0120.00616.29
7.3.250.0140.00616.40
7.3.240.0100.00816.44
7.3.230.0040.01316.39
7.3.210.0090.00916.49
7.3.200.0120.00916.44
7.3.190.0090.00916.54
7.3.180.0080.01216.50
7.3.170.0120.00916.44
7.3.160.0040.01616.54
7.3.120.0130.00614.59
7.3.110.0090.00914.76
7.3.100.0100.00614.74
7.3.90.0120.00314.93
7.3.80.0040.00715.08
7.3.70.0060.00614.57
7.3.60.0000.01614.66
7.3.50.0040.01114.46
7.3.40.0070.01014.84
7.3.30.0080.00314.94
7.3.20.0110.00416.79
7.3.10.0110.00416.70
7.3.00.0060.00916.25
7.2.330.0090.00916.53
7.2.320.0090.01216.66
7.2.310.0080.00816.44
7.2.300.0070.01016.68
7.2.290.0070.01016.83
7.2.250.0030.00914.99
7.2.240.0040.01514.88
7.2.230.0090.00914.82
7.2.220.0030.01315.07
7.2.210.0040.00815.06
7.2.200.0000.01315.02
7.2.190.0040.00814.81
7.2.180.0040.01114.96
7.2.170.0060.00915.19
7.2.160.0140.00015.27
7.2.150.0000.01516.96
7.2.140.0090.00317.04
7.2.130.0070.01316.96
7.2.120.0030.00916.87
7.2.110.0000.01016.98
7.2.100.0060.01216.63
7.2.90.0060.00617.05
7.2.80.0030.01016.80
7.2.70.0030.01217.04
7.2.60.0020.01516.98
7.2.50.0080.01117.04
7.2.40.0030.01016.73
7.2.30.0030.00917.04
7.2.20.0030.01217.01
7.2.10.0090.00617.07
7.2.00.0080.00918.22
7.1.330.0040.01415.82
7.1.320.0030.00615.78
7.1.310.0030.00615.80
7.1.300.0120.00015.56
7.1.290.0080.00815.68
7.1.280.0030.00915.83
7.1.270.0040.00815.64
7.1.260.0030.01015.98
7.1.250.0000.01115.53
7.1.240.0130.00315.89
7.1.230.0030.01015.87
7.1.220.0040.01115.63
7.1.210.0060.00315.57
7.1.200.0050.00915.72
7.1.190.0090.00316.00
7.1.180.0110.00715.71
7.1.170.0060.00315.80
7.1.160.0120.00015.97
7.1.150.0000.01115.71
7.1.140.0120.00315.84
7.1.130.0030.00715.86
7.1.120.0000.01415.97
7.1.110.0070.01015.64
7.1.100.0030.01116.96
7.1.90.0080.00815.69
7.1.80.0100.00015.53
7.1.70.0040.00616.47
7.1.60.0100.01017.45
7.1.50.0070.00716.34
7.1.40.0100.00315.80
7.1.30.0120.00616.00
7.1.20.0060.00615.96
7.1.10.0110.00415.81
7.1.00.0020.04219.11
7.0.330.0040.00415.48
7.0.320.0080.00615.42
7.0.310.0100.00715.12
7.0.300.0000.01415.56
7.0.290.0100.00715.21
7.0.280.0120.00415.48
7.0.270.0070.01015.36
7.0.260.0070.00715.06
7.0.250.0070.00415.20
7.0.240.0040.00415.48
7.0.230.0070.01015.39
7.0.220.0110.00415.36
7.0.210.0050.00515.50
7.0.200.0100.00615.16
7.0.190.0060.00615.31
7.0.180.0040.00715.42
7.0.170.0030.01015.50
7.0.160.0060.00915.47
7.0.150.0040.00715.10
7.0.140.0060.00615.18
7.0.130.0060.00315.44
7.0.120.0060.00615.54
7.0.110.0000.01115.45
7.0.100.0030.01015.25
7.0.90.0030.01015.57
7.0.80.0040.00715.39
7.0.70.0000.01315.27
7.0.60.0150.02517.71
7.0.50.0090.04016.74
7.0.40.0080.04516.88
7.0.30.0130.04016.72
7.0.20.0170.03816.85
7.0.10.0090.04216.80
7.0.00.0050.04716.68
5.6.400.0060.01314.71
5.6.390.0030.01014.32
5.6.380.0070.01014.32
5.6.370.0000.01014.20
5.6.360.0040.00814.25
5.6.350.0040.01214.37
5.6.340.0070.01014.27
5.6.330.0000.01514.34
5.6.320.0040.00814.35
5.6.310.0060.00314.58
5.6.300.0070.00714.60
5.6.290.0110.00314.11
5.6.280.0020.02817.74
5.6.270.0100.00714.45
5.6.260.0080.00814.68
5.6.250.0030.01014.43
5.6.240.0000.01614.38
5.6.230.0080.00414.24
5.6.220.0040.00514.41
5.6.210.0050.04317.32
5.6.200.0070.02216.23
5.6.190.0030.05017.45
5.6.180.0220.03817.46
5.6.170.0120.04417.56
5.6.160.0080.04217.34
5.6.150.0080.02016.26
5.6.140.0080.04016.13
5.6.130.0070.02516.32
5.6.120.0080.03717.59
5.6.110.0060.04617.59
5.6.100.0080.04417.61
5.6.90.0030.03617.56
5.6.80.0080.02617.36
5.6.70.0090.00614.31
5.6.60.0070.00714.08
5.6.50.0070.00714.54
5.6.40.0030.01314.09
5.6.30.0030.01614.07
5.6.20.0110.00714.43
5.6.10.0100.01014.34
5.6.00.0060.00314.12
5.5.380.0130.00314.25
5.5.370.0040.01114.31
5.5.360.0040.01114.49
5.5.350.2180.02317.33
5.5.340.0020.04916.11
5.5.330.0150.04217.29
5.5.320.0340.02917.30
5.5.310.0200.04017.42
5.5.300.0050.04616.14
5.5.290.0040.02316.13
5.5.280.0090.04417.54
5.5.270.0050.02317.70
5.5.260.0120.04017.66
5.5.250.0110.04017.49
5.5.240.0080.02217.21
5.5.230.0060.01214.39
5.5.220.0030.01014.26
5.5.210.0030.00614.04
5.5.200.0090.00914.19
5.5.190.0100.01014.05
5.5.180.0070.01014.41
5.5.170.0070.00614.38
5.5.160.0030.00714.33
5.5.150.0130.00014.30
5.5.140.0070.00714.30
5.5.130.0100.00313.80
5.5.120.0090.00914.07
5.5.110.0030.00813.93
5.5.100.0060.00614.17
5.5.90.0030.01314.42
5.5.80.0090.00614.12
5.5.70.0030.01414.07
5.5.60.0090.00314.32
5.5.50.0040.01114.36
5.5.40.0040.00714.11
5.5.30.0030.01013.91
5.5.20.0070.00713.90
5.5.10.0040.01114.41
5.5.00.0070.00714.12

preferences:
76.88 ms | 401 KiB | 5 Q