3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &get_instance_ref() { static $obj; $property ='a'; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign a reference to the static variable $obj = &new stdclass; } $obj->property++; return $obj; } function &get_instance_noref() { static $obj; $property='a'; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign the object to the static variable $obj = new stdclass; } $obj->property++; return $obj; } $obj1 = get_instance_ref(); $still_obj1 = get_instance_ref(); echo "\n"; $obj2 = get_instance_noref(); $still_obj2 = get_instance_noref(); ?>

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)
5.6.280.0000.07721.10
5.6.230.0070.04020.66
5.6.220.0100.07320.67
5.6.210.0130.05320.65
5.6.200.0000.05321.05
5.6.190.0200.08021.18
5.6.180.0100.07721.02
5.6.170.0200.07021.08
5.6.160.0170.07321.05
5.6.150.0030.05320.95
5.6.140.0070.06721.08
5.6.130.0070.08721.17
5.6.120.0100.06321.17
5.6.110.0030.08020.95
5.6.100.0100.07021.03
5.6.90.0070.05021.06
5.6.80.0030.04720.42
5.6.70.0030.04020.34
5.6.60.0030.04020.46
5.6.50.0000.06320.41
5.6.40.0070.06720.39
5.6.30.0130.06720.48
5.6.20.0030.04320.36
5.6.10.0030.06720.42
5.6.00.0100.03020.45
5.5.370.0000.05020.38
5.5.360.0030.04720.44
5.5.350.0070.08020.43
5.5.340.0070.05020.91
5.5.330.0030.08720.65
5.5.320.0070.07020.81
5.5.310.0000.09020.89
5.5.300.0100.08320.83
5.5.290.0070.04320.93
5.5.280.0030.08720.64
5.5.270.0130.04320.76
5.5.260.0000.04720.88
5.5.250.0070.07720.64
5.5.240.0100.05320.25
5.5.230.0070.07720.13
5.5.220.0070.04720.27
5.5.210.0030.08020.21
5.5.200.0030.04020.26
5.5.190.0000.05020.22
5.5.180.0000.06020.13
5.5.160.0130.07020.09
5.5.150.0070.05020.12
5.5.140.0070.03020.09
5.5.130.0030.04320.21
5.5.120.0070.06320.11
5.5.110.0030.04320.17
5.5.100.0000.05320.02
5.5.90.0070.03720.10
5.5.80.0100.03320.13
5.5.70.0030.04019.94
5.5.60.0070.04020.09
5.5.50.0070.04720.07
5.5.40.0030.07720.07
5.5.30.0100.05320.08
5.5.20.0100.05319.96
5.5.10.0030.04019.98
5.5.00.0100.05020.06
5.4.450.0070.04319.36
5.4.440.0030.04019.25
5.4.430.0070.04719.41
5.4.420.0030.05719.41
5.4.410.0070.04719.29
5.4.400.0100.07718.95
5.4.390.0070.04019.04
5.4.380.0030.05319.04
5.4.370.0030.05718.82
5.4.360.0200.04319.14
5.4.350.0030.06019.04
5.4.340.0030.09018.95
5.4.320.0000.07718.95
5.4.310.0130.07019.09
5.4.300.0130.06719.20
5.4.290.0100.03019.00
5.4.280.0100.06719.00
5.4.270.0030.03319.15
5.4.260.0070.03319.09
5.4.250.0100.05719.02
5.4.240.0030.03318.95
5.4.230.0070.03719.04
5.4.220.0070.07319.22
5.4.210.0070.06718.92
5.4.200.0070.05019.05
5.4.190.0030.04018.93
5.4.180.0000.04719.04
5.4.170.0070.03319.17
5.4.160.0030.05319.18
5.4.150.0070.07019.12
5.4.140.0030.04016.46
5.4.130.0130.02316.49
5.4.120.0100.04316.47
5.4.110.0070.04316.54
5.4.100.0000.04016.52
5.4.90.0070.06316.45
5.4.80.0030.03316.55
5.4.70.0070.04716.43
5.4.60.0100.03716.44
5.4.50.0100.04016.36
5.4.40.0000.04316.50
5.4.30.0030.06316.55
5.4.20.0030.03316.41
5.4.10.0000.06316.48
5.4.00.0000.05716.00
5.3.290.0000.08314.68
5.3.280.0130.03314.73
5.3.270.0030.06314.54
5.3.260.0030.06714.64
5.3.250.0070.03314.63
5.3.240.0000.04014.54
5.3.230.0000.04714.54
5.3.220.0000.05314.66
5.3.210.0070.04314.54
5.3.200.0100.03314.63
5.3.190.0030.03314.54
5.3.180.0000.04014.50
5.3.170.0030.04014.68
5.3.160.0030.06314.58
5.3.150.0030.06314.55
5.3.140.0000.04314.54
5.3.130.0000.04014.53
5.3.120.0000.04314.64
5.3.110.0030.04314.60
5.3.100.0070.08014.13
5.3.90.0030.07014.09
5.3.80.0030.07714.03
5.3.70.0030.03714.03
5.3.60.0000.05014.09
5.3.50.0070.06713.88
5.3.40.0000.04014.06
5.3.30.0070.03313.86
5.3.20.0030.05013.81
5.3.10.0100.05013.68
5.3.00.0030.05713.65
5.2.170.0000.04011.73
5.2.160.0000.04711.73
5.2.150.0030.05311.73
5.2.140.0030.03011.73
5.2.130.0100.04311.73
5.2.120.0030.02311.73
5.2.110.0030.06711.73
5.2.100.0030.06311.73
5.2.90.0030.03711.73
5.2.80.0030.07011.73
5.2.70.0070.06011.73
5.2.60.0030.05711.73
5.2.50.0070.05311.73
5.2.40.0000.02711.73
5.2.30.0000.04311.73
5.2.20.0000.04011.73
5.2.10.0000.03011.73
5.2.00.0000.03011.73
5.1.60.0030.03311.73
5.1.50.0000.02311.73
5.1.40.0030.02711.73
5.1.30.0100.03011.73
5.1.20.0030.02711.73
5.1.10.0000.02711.73
5.1.00.0070.02311.73
5.0.50.0070.01711.73
5.0.40.0000.02011.73
5.0.30.0030.03311.73
5.0.20.0030.01711.73
5.0.10.0030.01711.73
5.0.00.0000.03011.73
4.4.90.0000.01711.73
4.4.80.0000.01311.73
4.4.70.0000.01711.73
4.4.60.0000.01711.73
4.4.50.0070.01011.73
4.4.40.0000.04711.73
4.4.30.0070.02311.73
4.4.20.0000.01711.73
4.4.10.0000.01711.73
4.4.00.0030.02011.73
4.3.110.0000.01711.73
4.3.100.0000.01311.73
4.3.90.0000.01711.73
4.3.80.0000.02311.73
4.3.70.0000.01711.73
4.3.60.0000.01311.73
4.3.50.0000.01311.73
4.3.40.0000.02311.73
4.3.30.0030.01011.73
4.3.20.0000.01711.73
4.3.10.0030.01311.73
4.3.00.0000.01711.73

preferences:
148.48 ms | 1394 KiB | 7 Q