3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &get_instance_ref() { static $obj; 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; echo 'Static object: '; var_dump($obj); if (!isset($obj)) {$a=2; // Assign the object to the static variable $obj = new stdclass($this->a); } $obj->property++; return $obj; } $obj1 = get_instance_ref(); $still_obj1 = get_instance_ref(); echo "\n"; $obj2 = get_instance_noref(); $still_obj2 = get_instance_noref(); $still_obj3 = 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.0070.06721.15
5.6.210.0100.08020.65
5.6.200.0100.03718.16
5.6.190.0000.04720.63
5.6.180.0300.07320.63
5.6.170.0270.08020.47
5.6.160.0170.05020.45
5.6.150.0000.05718.19
5.6.140.0030.08718.24
5.6.130.0170.06318.18
5.6.120.0130.09020.99
5.6.110.0030.08020.90
5.6.100.0070.08021.14
5.6.90.0100.07721.00
5.6.80.0030.06020.39
5.6.70.4430.04720.36
5.5.350.0170.07320.36
5.5.340.0130.07717.98
5.5.330.0100.04020.42
5.5.320.0430.07320.27
5.5.310.0170.05720.31
5.5.300.0000.04318.04
5.5.290.0100.03317.95
5.5.280.0030.05020.88
5.5.270.0170.07320.80
5.5.260.0030.07020.88
5.5.250.0070.03720.60
5.5.240.0100.04720.08
5.4.450.0070.05319.34
5.4.440.0100.04019.52
5.4.430.0130.03719.47
5.4.420.0030.04719.56
5.4.410.0130.07019.05
5.4.400.0030.04019.16
5.4.390.0000.05019.19
5.4.380.0070.03719.24
5.4.370.0100.06719.12
5.4.360.0030.06019.16
5.4.350.0070.06718.85
5.4.340.0000.08018.87
5.4.320.0000.05319.20
5.4.310.0070.03719.24
5.4.300.0100.03319.14
5.4.290.0130.03319.18
5.4.280.0130.07719.15
5.4.270.0030.08019.23
5.4.260.0000.05318.98
5.4.250.0100.07018.91
5.4.240.0070.03719.23
5.4.230.0070.07719.00
5.4.220.0070.05719.14
5.4.210.0130.04319.04
5.4.200.0000.06018.96
5.4.190.0030.05018.91
5.4.180.0070.05318.84
5.4.170.0100.07319.23
5.4.160.0000.04019.22
5.4.150.0130.07019.06
5.4.140.0070.04716.46
5.4.130.0030.07016.36
5.4.120.0070.06316.58
5.4.110.0130.06316.45
5.4.100.0000.05016.46
5.4.90.0070.04716.33
5.4.80.0100.04716.45
5.4.70.0030.07016.48
5.4.60.0030.07016.47
5.4.50.0030.06016.43
5.4.40.0170.06316.27
5.4.30.0070.04716.34
5.4.20.0000.07716.38
5.4.10.0100.04016.63
5.4.00.0030.04315.74
5.3.290.0000.04314.83
5.3.280.0030.04314.66
5.3.270.0100.03314.64
5.3.260.0030.07714.61
5.3.250.0070.06714.68
5.3.240.0030.04714.62
5.3.230.0130.04014.63
5.3.220.0100.07014.61
5.3.210.0000.08314.58
5.3.200.0070.07314.58
5.3.190.0070.03714.63
5.3.180.0000.05314.64
5.3.170.0000.04014.64
5.3.160.0130.07014.60
5.3.150.0070.07714.61
5.3.140.0070.06314.63
5.3.130.0030.04714.60
5.3.120.0030.04014.48
5.3.110.0000.04314.44
5.3.100.0030.07314.06
5.3.90.0100.04014.10
5.3.80.0070.05713.97
5.3.70.0100.06013.95
5.3.60.0070.03714.08
5.3.50.0000.04013.84
5.3.40.0030.07313.90
5.3.30.0000.04014.06
5.3.20.0030.08313.65
5.3.10.0030.07013.73
5.3.00.0030.04313.64
5.2.170.0070.06011.05
5.2.160.0030.06311.30
5.2.150.0000.06011.13
5.2.140.0000.05311.16
5.2.130.0030.05011.13
5.2.120.0000.04011.14
5.2.110.0100.05711.25
5.2.100.0030.03011.11
5.2.90.0100.02711.13
5.2.80.0030.02711.07
5.2.70.0000.03011.25
5.2.60.0000.03011.13
5.2.50.0000.03010.98
5.2.40.0000.03011.02
5.2.30.0000.03010.92
5.2.20.0070.02311.11
5.2.10.0030.02711.02
5.2.00.0030.02710.89
5.1.60.0000.02710.00
5.1.50.0000.02710.00
5.1.40.0030.02710.07
5.1.30.0000.03010.38
5.1.20.0000.02710.25
5.1.10.0070.02010.04
5.1.00.0000.0279.98
5.0.50.0000.0208.58
5.0.40.0000.0208.58
5.0.30.0030.0278.58
5.0.20.0070.0178.58
5.0.10.0000.0208.58
5.0.00.0070.0238.58
4.4.90.0030.0138.58
4.4.80.0000.0178.58
4.4.70.0000.0178.58
4.4.60.0000.0178.58
4.4.50.0000.0138.58
4.4.40.0000.0278.58
4.4.30.0000.0238.58
4.4.20.0000.0178.58
4.4.10.0000.0178.58
4.4.00.0030.0238.58
4.3.110.0000.0178.58
4.3.100.0030.0138.58
4.3.90.0000.0138.58
4.3.80.0000.0238.58
4.3.70.0000.0138.58
4.3.60.0030.0208.58
4.3.50.0000.0138.58
4.3.40.0000.0278.58
4.3.30.0000.0138.58
4.3.20.0000.0178.58
4.3.10.0000.0138.58
4.3.00.0000.0178.58

preferences:
141.92 ms | 1394 KiB | 7 Q