3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { private static self $x; static function getInstance() { // all good return self::$x ??= new self(); } static function getInstance2() { // Not ok : cannot access before initialisation return self::$x = self::$x ?? new self(); } static function getError() { // Not ok : cannot access before initialisation if (!self::$x instanceof self) { self::$x = new self(); } return self::$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.5.30.0110.00618.11
8.5.20.0120.00520.31
8.5.10.0100.00816.25
8.5.00.0130.00819.93
8.4.180.0120.01119.32
8.4.170.0130.00824.03
8.4.160.0150.00922.05
8.4.150.0070.00516.69
8.4.140.0110.01017.38
8.4.130.0160.00317.55
8.4.120.0130.00720.82
8.4.110.0110.00822.29
8.4.100.0130.00817.64
8.4.90.0130.00817.54
8.4.80.0220.00617.52
8.4.70.0180.00817.54
8.4.60.0390.01117.49
8.4.50.0320.01217.41
8.4.40.0400.01117.16
8.4.30.0470.00517.27
8.4.20.0410.00617.50
8.4.10.0370.01316.99
8.3.300.0110.01120.78
8.3.290.0110.00920.72
8.3.280.0090.01118.21
8.3.270.0100.00916.50
8.3.260.0120.00916.45
8.3.250.0120.00718.73
8.3.240.0120.00716.51
8.3.230.0110.00816.60
8.3.220.0170.00816.97
8.3.210.0150.00516.97
8.3.200.0230.00616.97
8.3.190.0340.01116.97
8.3.180.0430.00516.97
8.3.170.0420.00816.97
8.3.160.0330.00616.97
8.3.150.0350.01116.97
8.3.140.0380.00716.97
8.3.130.0400.00516.97
8.3.120.0460.00316.97
8.3.110.0360.01116.97
8.3.100.0320.00516.97
8.3.90.0370.00916.97
8.3.80.0410.00916.97
8.3.70.0410.01116.97
8.3.60.0430.00716.97
8.3.50.0410.01016.97
8.3.40.0400.00916.97
8.3.30.0310.00917.19
8.3.20.0340.00917.07
8.3.10.0250.01017.12
8.3.00.0160.00616.98
8.2.300.0150.00920.35
8.2.290.0060.00220.37
8.2.280.0190.00616.97
8.2.270.0160.00616.97
8.2.260.0180.00216.97
8.2.250.0140.00716.97
8.2.240.0220.00116.97
8.2.230.0130.00616.97
8.2.220.0170.00316.97
8.2.210.0260.00716.97
8.2.200.0300.01116.97
8.2.190.0320.00916.97
8.2.180.0370.00616.97
8.2.170.0320.00817.50
8.2.160.0230.00317.34
8.2.150.0340.00917.41
8.2.140.0290.00717.46
8.2.130.0150.00617.35
8.2.120.0350.01017.41
8.2.110.0360.00917.36
8.2.100.0150.00517.62
8.2.90.0140.00517.47
8.2.80.0340.01317.41
8.2.70.0360.00817.51
8.2.60.0290.01017.53
8.2.50.0320.01017.29
8.2.40.0270.00717.33
8.2.30.0190.00217.29
8.2.20.0300.00917.46
8.2.10.0260.00317.29
8.2.00.0170.00317.28
8.1.340.0110.00920.07

preferences:
43.5 ms | 840 KiB | 5 Q