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($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.210.0130.06720.47
5.6.200.0000.04718.29
5.6.190.0070.08720.50
5.6.180.0230.04320.58
5.6.170.0270.04020.57
5.6.160.0070.06020.39
5.6.150.0100.07718.15
5.6.140.0000.06718.19
5.6.130.0030.08318.12
5.6.120.0030.04321.00
5.6.110.0170.07721.00
5.6.100.0170.07321.02
5.6.90.0070.08721.01
5.6.80.0100.07320.41
5.6.70.0230.07720.39
5.5.350.0470.05720.36
5.5.340.0070.07717.96
5.5.330.0200.04720.43
5.5.320.0270.05320.23
5.5.310.0130.04720.32
5.5.300.0030.06717.93
5.5.290.0030.04718.03
5.5.280.0100.08320.81
5.5.270.0070.08020.68
5.5.260.0130.08020.66
5.5.250.0070.07320.79
5.5.240.0070.07720.21
5.4.450.0000.06019.48
5.4.440.0070.04019.50
5.4.430.0070.03719.20
5.4.420.0070.06319.56
5.4.410.0000.04719.32
5.4.400.0030.07719.21
5.4.390.0130.07719.20
5.4.380.0130.03019.15
5.4.370.0030.04018.89
5.4.360.0030.07018.88
5.4.350.0100.03318.87
5.4.340.0070.07718.98
5.4.320.0070.07719.15
5.4.310.0030.05019.12
5.4.300.0030.07318.85
5.4.290.0100.07319.25
5.4.280.0070.05319.24
5.4.270.0100.04018.98
5.4.260.0170.05019.14
5.4.250.0070.08019.23
5.4.240.0030.08018.91
5.4.230.0030.08018.87
5.4.220.0070.07019.24
5.4.210.0070.08018.86
5.4.200.0030.05018.87
5.4.190.0070.06019.14
5.4.180.0030.07719.23
5.4.170.0200.06019.23
5.4.160.0100.07719.06
5.4.150.0070.04719.13
5.4.140.0100.07016.46
5.4.130.0170.05316.34
5.4.120.0070.06316.47
5.4.110.0000.04716.34
5.4.100.0070.05016.33
5.4.90.0030.03716.48
5.4.80.0200.05716.46
5.4.70.0100.03016.43
5.4.60.0100.07016.28
5.4.50.0070.06716.46
5.4.40.0130.04716.25
5.4.30.0000.06316.64
5.4.20.0230.05316.43
5.4.10.0100.07016.46
5.4.00.0000.07015.78
5.3.290.0130.04314.68
5.3.280.0100.07314.67
5.3.270.0130.07714.67
5.3.260.0100.05714.76
5.3.250.0070.05014.66
5.3.240.0030.04314.61
5.3.230.0070.07014.60
5.3.220.0100.05714.49
5.3.210.0070.04314.64
5.3.200.0030.07714.57
5.3.190.0070.06314.73
5.3.180.0070.04714.61
5.3.170.0100.04714.71
5.3.160.0100.04014.57
5.3.150.0100.06714.56
5.3.140.0070.04714.45
5.3.130.0070.07714.55
5.3.120.0070.07314.70
5.3.110.0130.07014.70
5.3.100.0030.07014.04
5.3.90.0100.05713.91
5.3.80.0130.05013.99
5.3.70.0100.06714.09
5.3.60.0170.06313.95
5.3.50.0130.03714.01
5.3.40.0070.07013.88
5.3.30.0030.04013.86
5.3.20.0100.07013.70
5.3.10.0000.08013.58
5.3.00.0130.07313.56
5.2.170.0100.05011.21
5.2.160.0000.04711.21
5.2.150.0030.05311.23
5.2.140.0100.04011.22
5.2.130.0030.03711.04
5.2.120.0170.03311.11
5.2.110.0100.05711.16
5.2.100.0000.06711.20
5.2.90.0030.03311.11
5.2.80.0100.05311.07
5.2.70.0100.03711.11
5.2.60.0070.06311.06
5.2.50.0130.05011.09
5.2.40.0070.05011.01
5.2.30.0030.06010.98
5.2.20.0030.04711.01
5.2.10.0070.05710.84
5.2.00.0000.03010.64
5.1.60.0030.03010.06
5.1.50.0000.03710.14
5.1.40.0030.0309.95
5.1.30.0070.05310.38
5.1.20.0030.05310.39
5.1.10.0100.04310.10
5.1.00.0070.04310.14
5.0.50.0070.0438.51
5.0.40.0030.0338.44
5.0.30.0000.0708.30
5.0.20.0070.0408.22
5.0.10.0030.0178.22
5.0.00.0030.0638.23
4.4.90.0000.0208.22
4.4.80.0030.0338.22
4.4.70.0000.0338.22
4.4.60.0000.0378.22
4.4.50.0000.0278.22
4.4.40.0030.0538.22
4.4.30.0030.0208.22
4.4.20.0030.0338.22
4.4.10.0030.0378.22
4.4.00.0030.0508.22
4.3.110.0100.0278.22
4.3.100.0070.0138.22
4.3.90.0000.0178.22
4.3.80.0030.0578.22
4.3.70.0000.0378.22
4.3.60.0070.0308.22
4.3.50.0030.0338.22
4.3.40.0000.0378.22
4.3.30.0000.0378.22
4.3.20.0000.0408.22
4.3.10.0030.0238.22
4.3.00.0000.0178.22

preferences:
141.86 ms | 1394 KiB | 7 Q