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; static $property=2; stdclass::$obj->property; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign the object to the static variable $obj = new stdclass; echo $property; } $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.10.0130.07720.39
5.6.00.0270.06020.37
5.5.160.0100.08020.25
5.5.150.0070.05320.05
5.5.140.0070.06320.25
5.5.130.0130.03720.39
5.5.120.0030.04020.25
5.5.110.0000.04320.13
5.5.100.0070.03720.27
5.5.90.0130.03020.14
5.5.80.0130.04720.05
5.5.70.0070.04020.22
5.5.60.0070.05320.16
5.5.50.0070.06720.26
5.5.40.0130.06319.97
5.5.30.0070.07020.27
5.5.20.0070.07720.25
5.5.10.0100.03020.14
5.5.00.0000.04320.17
5.4.320.0170.05319.33
5.4.310.0100.07018.95
5.4.300.0070.04019.18
5.4.290.0070.03719.24
5.4.280.0000.05019.24
5.4.270.0070.04019.01
5.4.260.0030.03718.99
5.4.250.0100.06719.37
5.4.240.0000.04018.94
5.4.230.0000.05019.22
5.4.220.0100.03018.95
5.4.210.0130.04019.23
5.4.200.0070.03318.98
5.4.190.0030.04718.99
5.4.180.0130.07018.98
5.4.170.0030.05019.00
5.4.160.0030.03718.94
5.4.150.0100.03019.07
5.4.140.0000.04716.59
5.4.130.0000.04016.43
5.4.120.0000.05016.44
5.4.110.0070.06316.48
5.4.100.0030.03316.52
5.4.90.0070.03716.61
5.4.80.0000.03716.60
5.4.70.0030.03316.58
5.4.60.0030.03316.54
5.4.50.0100.03016.54
5.4.40.0000.04716.58
5.4.30.0000.04316.53
5.4.20.0100.05316.48
5.4.10.0030.05716.44
5.4.00.0030.03315.77
5.3.290.0100.06714.66
5.3.280.0070.04714.60
5.3.270.0070.07014.63
5.3.260.0030.05714.60
5.3.250.0030.03714.57
5.3.240.0000.04314.47
5.3.230.0130.03014.63
5.3.220.0130.06314.70
5.3.210.0000.04014.81
5.3.200.0000.04014.80
5.3.190.0070.03714.70
5.3.180.0000.04014.65
5.3.170.0000.04014.65
5.3.160.0000.04014.80
5.3.150.0000.04014.70
5.3.140.0030.04014.70
5.3.130.0000.04314.56
5.3.120.0100.03014.64
5.3.110.0030.04014.57
5.3.100.0070.03714.06
5.3.90.0070.03314.11
5.3.80.0000.04014.05
5.3.70.0070.03314.04
5.3.60.0100.07314.09
5.3.50.0000.04714.04
5.3.40.0000.04013.97
5.3.30.0030.03313.90
5.3.20.0070.03313.78
5.3.10.0070.06313.68
5.3.00.0030.07313.71
5.2.170.0030.03011.13
5.2.160.0030.03311.24
5.2.150.0070.02711.14
5.2.140.0000.03011.15
5.2.130.0100.05711.11
5.2.120.0070.05011.20
5.2.110.0070.04711.24
5.2.100.0070.05711.12
5.2.90.0070.05711.11
5.2.80.0070.05711.11
5.2.70.0070.06011.12
5.2.60.0030.06011.07
5.2.50.0070.06011.09
5.2.40.0000.05711.07
5.2.30.0030.06310.83
5.2.20.0030.06010.95
5.2.10.0030.02711.09
5.2.00.0100.05310.73
5.1.60.0000.05310.16
5.1.50.0000.03310.08
5.1.40.0070.0409.95
5.1.30.0100.04710.41
5.1.20.0030.05310.31
5.1.10.0000.0579.91
5.1.00.0070.05010.05
5.0.50.0070.0408.56
5.0.40.0000.0238.38
5.0.30.0000.0678.30
5.0.20.0000.0278.23
5.0.10.0030.0478.18
5.0.00.0030.0638.42
4.4.90.0030.0337.91
4.4.80.0000.0177.91
4.4.70.0030.0337.91
4.4.60.0000.0407.91
4.4.50.0070.0307.91
4.4.40.0070.0477.91
4.4.30.0030.0337.91
4.4.20.0030.0337.91
4.4.10.0030.0337.91
4.4.00.0070.0437.91
4.3.110.0030.0337.91
4.3.100.0000.0337.91
4.3.90.0030.0307.91
4.3.80.0000.0407.91
4.3.70.0000.0377.91
4.3.60.0030.0337.91
4.3.50.0030.0237.91
4.3.40.0100.0407.91
4.3.30.0000.0377.91
4.3.20.0000.0377.91
4.3.10.0000.0377.91
4.3.00.0100.0277.91

preferences:
142.58 ms | 1394 KiB | 7 Q