3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static $instance; public static function getInstance() { if (self::$instance === null) { self::$instance = new static(); } return static::$instance; } } class B extends A { public static $instance; } class C extends A { } echo get_class(A::getInstance()) . PHP_EOL; echo var_dump(B::getInstance()) . PHP_EOL; //As you can see, a new B is instantiated here, because B::$instance is a priority over A::$instance. echo get_class(A::getInstance()) . PHP_EOL; A::$instance = null; echo PHP_EOL; echo get_class(A::getInstance()) . PHP_EOL; echo get_class(C::getInstance()) . PHP_EOL; //But here, there is no C::$instance, so let's check the A::$instance which is not empty. echo get_class(A::getInstance()) . PHP_EOL;

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.0100.01018.31
8.3.50.0140.00718.38
8.3.40.0030.01218.97
8.3.30.0040.01118.62
8.3.20.0000.00720.16
8.3.10.0040.00421.60
8.3.00.0000.00820.17
8.2.180.0110.01118.25
8.2.170.0060.00922.96
8.2.160.0070.00722.21
8.2.150.0030.00524.18
8.2.140.0050.00324.66
8.2.130.0030.00526.16
8.2.120.0100.00017.63
8.2.110.0070.00321.11
8.2.100.0040.00817.63
8.2.90.0000.00819.12
8.2.80.0040.00417.97
8.2.70.0000.00917.37
8.2.60.0030.00717.93
8.2.50.0000.00818.07
8.2.40.0070.00019.42
8.2.30.0090.00020.73
8.2.20.0080.00017.61
8.2.10.0050.00318.07
8.2.00.0050.00317.98
8.1.280.0060.00925.92
8.1.270.0030.00523.96
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.19
8.1.230.0040.00717.48
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.36
8.1.180.0040.00418.10
8.1.170.0050.00318.46
8.1.160.0040.00422.11
8.1.150.0000.00718.86
8.1.140.0040.00417.42
8.1.130.0040.00417.68
8.1.120.0000.00717.42
8.1.110.0030.00517.53
8.1.100.0000.00717.52
8.1.90.0030.00317.46
8.1.80.0000.00717.40
8.1.70.0030.00317.52
8.1.60.0080.00017.59
8.1.50.0040.00417.57
8.1.40.0080.00317.56
8.1.30.0030.00517.65
8.1.20.0020.00517.69
8.1.10.0040.00417.58
8.1.00.0040.00417.42
8.0.300.0060.00618.77
8.0.290.0040.00416.88
8.0.280.0030.00518.52
8.0.270.0000.00717.21
8.0.260.0000.00717.32
8.0.250.0040.00416.91
8.0.240.0000.00716.95
8.0.230.0030.00316.98
8.0.220.0050.00316.98
8.0.210.0020.00516.98
8.0.200.0000.00716.99
8.0.190.0030.00516.91
8.0.180.0040.00716.96
8.0.170.0040.00416.93
8.0.160.0070.00017.00
8.0.150.0080.00016.93
8.0.140.0070.00016.92
8.0.130.0030.00313.38
8.0.120.0050.00316.91
8.0.110.0040.00416.84
8.0.100.0070.00016.77
8.0.90.0000.00816.74
8.0.80.0060.01016.91
8.0.70.0080.00016.96
8.0.60.0030.00316.79
8.0.50.0000.00816.75
8.0.30.0110.00817.05
8.0.20.0090.01217.40
8.0.10.0000.00816.82
8.0.00.0090.01116.66
7.4.330.0000.00515.15
7.4.320.0060.00316.49
7.4.300.0060.00016.62
7.4.290.0070.00016.66
7.4.280.0080.00016.43
7.4.270.0030.00616.51
7.4.260.0030.00316.54
7.4.250.0030.00616.59
7.4.240.0030.00416.52
7.4.230.0030.00316.64
7.4.220.0060.01316.39
7.4.210.0040.01116.63
7.4.200.0000.00716.70
7.4.160.0060.00916.52
7.4.150.0030.01417.40
7.4.140.0100.00917.86
7.4.130.0160.00216.67
7.4.120.0120.00616.50
7.4.110.0140.00316.30
7.4.100.0130.00716.57
7.4.90.0070.01416.59
7.4.80.0080.01619.39
7.4.70.0070.01116.40
7.4.60.0000.01916.54
7.4.50.0040.00316.70
7.4.40.0070.01016.61
7.4.30.0150.00316.57
7.4.00.0040.01115.18
7.3.330.0030.00313.17
7.3.320.0060.00013.17
7.3.310.0050.00216.41
7.3.300.0000.00716.27
7.3.290.0060.00816.30
7.3.280.0100.00816.30
7.3.270.0070.01017.40
7.3.260.0140.00316.52
7.3.250.0090.00916.25
7.3.240.0130.00616.68
7.3.230.0090.00916.39
7.3.210.0080.00816.47
7.3.200.0070.01016.20
7.3.190.0060.00916.23
7.3.180.0090.00616.36
7.3.170.0180.00016.48
7.3.160.0100.01016.54
7.2.330.0100.01016.83
7.2.320.0070.01016.54
7.2.310.0000.01716.41
7.2.300.0100.00716.42
7.2.290.0080.01116.72
7.2.60.0030.01416.68
7.2.00.0040.01119.36
7.1.200.0090.00315.73
7.1.100.0170.00317.93
7.1.70.0030.00717.21
7.1.60.0110.00419.11
7.1.50.0130.01016.85
7.1.00.0070.07322.27
7.0.200.0000.01016.64
7.0.60.0030.05319.95
7.0.50.0100.07717.89
7.0.40.0030.05320.29
7.0.30.0300.06020.25
7.0.20.0130.09020.21
7.0.10.0170.07720.33
7.0.00.0170.07020.23
5.6.280.0030.07020.82
5.6.210.0070.08020.57
5.6.200.0100.06318.19
5.6.190.0100.08020.43
5.6.180.0400.07720.51
5.6.170.0230.04020.46
5.6.160.0070.08320.52
5.6.150.0130.07318.23
5.6.140.0100.08318.15
5.6.130.0100.04018.23
5.6.120.0070.05321.03
5.6.110.0030.09021.07
5.6.100.0070.08321.14
5.6.90.0100.08320.97
5.6.80.0170.07020.29
5.5.350.0000.06020.36
5.5.340.0170.03017.95
5.5.330.0070.04320.19
5.5.320.3770.04720.25
5.5.310.0270.08020.28
5.5.300.0030.08017.99
5.5.290.0100.04018.03
5.5.280.0000.04720.89
5.5.270.0030.04020.86
5.5.260.0030.05720.68
5.5.250.0200.06720.48
5.5.240.0070.07020.07
5.4.450.0900.06019.63
5.4.440.1070.07019.38
5.4.430.0930.06719.39
5.4.420.0830.05319.58
5.4.410.0770.06719.38
5.4.400.1100.05019.10
5.4.390.1000.05319.09
5.4.380.0630.06319.09
5.4.370.0830.06319.24
5.4.360.0800.06319.21
5.4.350.1000.05019.01
5.4.340.0970.04718.84
5.4.320.0830.06318.94
5.4.310.0870.05019.09
5.4.300.0900.05019.12
5.4.290.0830.06019.09
5.4.280.0800.07319.20
5.4.270.0870.04719.30
5.4.260.0930.05319.09
5.4.250.1000.05018.86
5.4.240.0830.06018.83
5.4.230.1070.05318.83
5.4.220.0800.06018.93
5.4.210.0800.06018.83
5.4.200.0800.06719.09
5.4.190.0670.05019.16
5.4.180.0130.05319.09
5.4.170.0570.06719.09
5.4.160.0900.06019.07
5.4.150.0670.06719.08
5.4.140.0400.06016.36
5.4.130.0170.05316.48
5.4.120.0900.05716.43
5.4.110.0870.05316.63
5.4.100.0700.05716.52
5.4.90.0100.05016.65
5.4.80.0500.06016.61
5.4.70.0330.06316.33
5.4.60.0070.03716.35
5.4.50.0070.06016.52
5.4.40.0300.04016.23
5.4.30.0170.04016.57
5.4.20.0200.03316.18

preferences:
40.7 ms | 400 KiB | 5 Q