3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class A{ static protected $shared = array(); static function create(){ if (isset(static::$shared['mailer'])){ return static::$shared['mailer']; } $mailer = new static(); //this is the correct way return static::$shared['mailer'] = $mailer; } } class B extends A{ } $obj=B::create(); $obj1=B::create(); var_dump($obj); var_dump($obj1);

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.0090.00618.30
8.3.60.0100.01016.38
8.3.50.0130.00522.07
8.3.40.0040.01118.74
8.3.30.0090.00618.59
8.3.20.0060.00318.79
8.3.10.0040.00421.90
8.3.00.0030.00521.91
8.2.190.0070.00718.54
8.2.180.0140.00316.38
8.2.170.0170.00022.96
8.2.160.0110.00422.08
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0160.00319.95
8.2.120.0040.00426.35
8.2.110.0000.01021.13
8.2.100.0060.00617.81
8.2.90.0050.00319.40
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0080.00018.05
8.2.50.0030.00618.10
8.2.40.0040.00420.48
8.2.30.0070.00019.30
8.2.20.0040.00417.94
8.2.10.0000.00818.10
8.2.00.0030.00617.77
8.1.280.0090.00625.92
8.1.270.0050.00322.24
8.1.260.0040.00428.09
8.1.250.0000.00728.09
8.1.240.0090.00022.23
8.1.230.0000.01117.71
8.1.220.0040.00417.74
8.1.210.0080.00018.77
8.1.200.0040.00417.35
8.1.190.0040.00417.23
8.1.180.0040.00418.10
8.1.170.0080.00018.65
8.1.160.0000.00723.96
8.1.150.0070.00022.05
8.1.140.0030.00519.50
8.1.130.0030.00517.69
8.1.120.0000.00717.42
8.1.110.0000.00717.37
8.1.100.0030.00317.37
8.1.90.0000.00817.46
8.1.80.0040.00417.27
8.1.70.0000.00717.39
8.1.60.0080.00017.59
8.1.50.0050.00317.52
8.1.40.0040.00417.41
8.1.30.0000.00817.54
8.1.20.0040.00417.52
8.1.10.0040.00417.61
8.1.00.0030.00717.52
8.0.300.0000.00718.77
8.0.290.0070.00016.63
8.0.280.0070.00018.31
8.0.270.0030.00617.09
8.0.260.0000.00617.10
8.0.250.0030.00316.82
8.0.240.0000.00816.91
8.0.230.0050.00216.89
8.0.220.0030.00316.70
8.0.210.0040.00416.79
8.0.200.0000.00616.77
8.0.190.0070.00016.77
8.0.180.0080.00016.79
8.0.170.0000.00716.80
8.0.160.0000.00816.84
8.0.150.0040.00416.72
8.0.140.0000.00716.68
8.0.130.0000.00813.20
8.0.120.0040.00416.75
8.0.110.0030.00616.79
8.0.100.0040.00416.90
8.0.90.0050.00216.89
8.0.80.0090.00616.74
8.0.70.0000.00816.88
8.0.60.0040.00416.88
8.0.50.0000.00716.67
8.0.30.0090.00716.98
8.0.20.0080.01417.40
8.0.10.0040.00416.96
8.0.00.0110.00816.79
7.4.330.0000.00515.55
7.4.320.0000.00616.44
7.4.300.0030.00316.47
7.4.290.0030.00316.50
7.4.280.0060.00316.43
7.4.270.0040.00416.49
7.4.260.0000.00916.60
7.4.250.0040.00416.44
7.4.240.0040.00416.57
7.4.230.0000.00716.46
7.4.220.0060.01316.48
7.4.210.0130.00916.46
7.4.200.0030.00316.44
7.4.160.0090.01016.47
7.4.150.0060.01217.40
7.4.140.0100.00817.86
7.4.130.0090.01216.49
7.4.120.0110.00816.57
7.4.110.0110.00716.45
7.4.100.0050.01116.55
7.4.90.0100.00716.58
7.4.80.0210.00419.39
7.4.70.0140.00316.40
7.4.60.0100.00616.54
7.4.50.0070.00716.31
7.4.40.0100.00716.46
7.4.30.0090.00616.48
7.4.00.0110.00715.16
7.3.330.0000.00613.20
7.3.320.0000.00513.21
7.3.310.0030.00316.32
7.3.300.0000.00716.29
7.3.290.0080.01216.36
7.3.280.0130.00716.39
7.3.270.0130.00717.40
7.3.260.0110.01016.54
7.3.250.0110.00516.45
7.3.240.0160.01016.63
7.3.230.0100.00716.40
7.3.210.0070.01016.39
7.3.200.0090.00716.73
7.3.190.0100.00716.42
7.3.180.0000.01616.61
7.3.170.0060.01616.67
7.3.160.0030.01716.41
7.3.10.0150.00316.07
7.3.00.0130.00716.28
7.2.330.0120.01216.79
7.2.320.0030.01416.64
7.2.310.0110.01216.76
7.2.300.0110.01216.84
7.2.290.0110.00616.50
7.2.130.0100.00616.48
7.2.120.0150.01516.79
7.2.110.0110.00416.44
7.2.100.0090.00916.10
7.2.90.0190.00816.88
7.2.80.0150.00616.32
7.2.70.0070.01116.70
7.2.60.0110.00616.82
7.2.50.0100.00916.73
7.2.40.0120.00916.43
7.2.30.0160.01016.86
7.2.20.0150.00516.01
7.2.10.0140.00916.83
7.2.00.0060.01218.23
7.1.250.0110.01515.48
7.1.200.0050.00515.84
7.1.70.0040.00417.34
7.1.60.0040.00817.13
7.1.00.0070.07322.33
7.0.200.0220.00714.74
7.0.120.0000.07722.06
7.0.110.0170.06722.04
7.0.100.0100.07322.17
7.0.90.0100.06321.98
7.0.80.0100.06722.09
7.0.70.0170.07322.07
7.0.60.0130.07022.11
7.0.50.0070.08322.11
7.0.40.0030.08321.99
7.0.30.0100.06022.04
7.0.20.0030.08022.10
7.0.10.0100.06722.02
7.0.00.0070.06722.04
5.6.270.0230.05320.88
5.6.260.0070.06720.97
5.6.250.0070.08021.13
5.6.240.0100.08021.04
5.6.230.0070.07321.00
5.6.220.0200.06320.86
5.6.210.0000.09020.99
5.6.200.0100.08020.80
5.6.190.0170.07720.83
5.6.180.0130.04720.95
5.6.170.0170.05320.99
5.6.160.0100.06720.94
5.6.150.0030.08020.80
5.6.140.0100.06320.83
5.6.130.0170.07320.75
5.6.120.0070.08320.85
5.6.110.0070.06720.79
5.6.100.0130.07720.99
5.6.90.0070.07021.02
5.6.80.0100.05720.38
5.6.70.0030.06720.27
5.6.60.0130.07020.41
5.6.50.0100.06720.22
5.6.40.0100.06720.11
5.6.30.0100.05720.37
5.6.20.0170.07320.34
5.6.10.0100.07320.21
5.6.00.0130.05020.19

preferences:
60.03 ms | 401 KiB | 5 Q