3v4l.org

run code in 300+ PHP versions simultaneously
<?php // https://ru.stackoverflow.com/questions/1444784 class MyExc1 extends \Exception {} class MyExc2 extends \Exception {} class ExcController { private static $map = [ 22 => MyExc1::class, 28 => MyExc2::class, ]; public static function getExceptionClassByCode($curlErr) { return self::$map[$curlErr]; } public static function throwExceptionByCode($curlErr, $msg) { throw new self::$map[$curlErr]($msg); } } // обратите внимание на круглые скобки /* 1 */ throw new (ExcController::getExceptionClassByCode(22)); // throw new (MyExc1); /* 2 */ throw new (ExcController::getExceptionClassByCode(22))('qwerty'); // throw new (MyExc1)('qwerty') /* 3 */ ExcController::throwExceptionByCode(22, 'qwerty'); // идентичный результат

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.00916.62
8.3.50.0090.00618.42
8.3.40.0060.00920.48
8.3.30.0090.00618.45
8.3.20.0040.00424.18
8.3.10.0050.00324.66
8.3.00.0000.00726.16
8.2.180.0150.00025.92
8.2.170.0000.01518.94
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0080.00020.90
8.2.110.0040.00421.00
8.2.100.0120.00017.91
8.2.90.0050.00220.59
8.2.80.0080.00019.29
8.2.70.0050.00317.63
8.2.60.0080.00017.63
8.2.50.0030.00518.05
8.2.40.0040.00418.28
8.2.30.0020.00518.09
8.2.20.0030.00519.28
8.2.10.0000.00818.04
8.2.00.0050.00221.07
8.1.280.0170.00325.92
8.1.270.0050.00224.66
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00722.51
8.1.230.0040.00820.85
8.1.220.0080.00017.75
8.1.210.0090.00019.04
8.1.200.0040.00417.34
8.1.190.0000.00817.21
8.1.180.0090.00318.10
8.1.170.0050.00317.62
8.1.160.0040.00418.89
8.1.150.0000.00818.59
8.1.140.0040.00417.41
8.1.130.0030.00318.84
8.1.120.0040.00417.31
8.1.110.0000.00717.32
8.1.100.0140.00517.38
8.1.90.0120.00417.29
8.1.80.0130.00317.43
8.1.70.0080.00817.27
8.1.60.0140.00517.40
8.1.50.0170.00417.30
8.1.40.0090.00917.46
8.1.30.0170.00317.63
8.1.20.0180.00017.42
8.1.10.0150.00317.49
8.1.00.0140.00617.47
8.0.300.0000.00819.98
8.0.290.0030.00616.75
8.0.280.0060.00318.30
8.0.270.0070.00016.80
8.0.260.0070.00018.44
8.0.250.0000.00717.01
8.0.240.0000.00716.98
8.0.230.0160.00016.85
8.0.220.0140.00316.70
8.0.210.0120.00416.86
8.0.200.0100.00516.91
8.0.190.0110.00616.85
8.0.180.0100.00516.75
8.0.170.0080.00816.93
8.0.160.0090.00616.97
8.0.150.0100.00516.86
8.0.140.0080.00816.96
8.0.130.0120.00516.82
8.0.120.0150.00016.87
8.0.110.0080.00816.98
8.0.100.0090.00616.91
8.0.90.0060.01116.99
8.0.80.0130.00316.82
8.0.70.0110.00516.88
8.0.60.0080.00816.96
8.0.50.0080.00716.95
8.0.30.0120.00316.90
8.0.20.0050.01016.98
8.0.10.0160.00016.86
7.4.330.0040.00015.55
7.4.320.0040.00416.35
7.4.300.0090.00616.30
7.4.290.0170.00016.31
7.4.280.0110.00616.27
7.4.270.0100.00716.24
7.4.260.0150.00316.39
7.4.250.0120.00616.41
7.4.240.0140.00316.33
7.4.230.0140.00416.36
7.4.220.0090.00716.48
7.4.210.0140.00016.29
7.4.200.0110.00416.30
7.4.190.0090.00516.52
7.4.180.0120.00316.52
7.4.160.0140.00016.41
7.4.150.0110.00516.28
7.4.140.0100.00516.21
7.4.130.0120.00316.24
7.4.120.0070.00716.15
7.4.110.0100.00416.22
7.4.100.0170.00016.40
7.4.90.0130.00316.21
7.4.80.0150.00016.25
7.4.70.0080.00816.36
7.4.60.0070.00716.29
7.4.50.0070.01016.07
7.4.40.0130.00416.14
7.4.30.0090.00616.32
7.4.20.0070.01116.10
7.4.10.0080.00816.28
7.4.00.0120.00816.25

preferences:
72.18 ms | 400 KiB | 5 Q