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; 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"; $property=2; $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.0100.06720.90
5.6.210.0030.08320.48
5.6.200.0100.08318.16
5.6.190.0030.05320.64
5.6.180.4200.04020.48
5.6.170.0470.07020.55
5.6.160.0130.07720.71
5.6.150.0030.04018.18
5.6.140.0130.07318.18
5.6.130.0100.08318.19
5.6.120.0130.08020.99
5.6.110.0030.04021.05
5.6.100.0170.07321.05
5.6.90.0030.04721.01
5.6.80.0070.06720.41
5.6.70.4300.03720.54
5.5.350.0330.06720.48
5.5.340.0070.07717.98
5.5.330.0030.04320.44
5.5.320.0230.06020.41
5.5.310.0300.05020.34
5.5.300.0030.06318.03
5.5.290.0070.06718.06
5.5.280.0170.07320.66
5.5.270.0070.06020.65
5.5.260.0070.04720.85
5.5.250.0100.06320.78
5.5.240.0230.07720.13
5.4.450.0230.04719.51
5.4.440.0370.06719.33
5.4.430.0200.03719.54
5.4.420.0330.06319.63
5.4.410.0200.04319.07
5.4.400.0370.06318.86
5.4.390.0230.04019.00
5.4.380.0300.06319.19
5.4.370.0270.04319.05
5.4.360.0200.04719.15
5.4.350.0170.04719.09
5.4.340.0230.07019.07
5.4.320.0300.06719.32
5.4.310.0130.05019.32
5.4.300.0300.07018.99
5.4.290.0270.03719.22
5.4.280.0200.06019.31
5.4.270.0370.05719.19
5.4.260.0230.05019.20
5.4.250.0200.05019.08
5.4.240.0200.07718.84
5.4.230.0200.05719.15
5.4.220.0270.07318.85
5.4.210.0200.05019.24
5.4.200.0300.05719.07
5.4.190.0270.04719.21
5.4.180.0270.06319.23
5.4.170.0270.06718.84
5.4.160.0200.05318.85
5.4.150.0230.08019.07
5.4.140.0230.04716.57
5.4.130.0230.07016.54
5.4.120.0300.04016.58
5.4.110.0230.07016.63
5.4.100.0200.03716.59
5.4.90.0170.03716.31
5.4.80.0230.05016.59
5.4.70.0230.06716.55
5.4.60.0130.07316.43
5.4.50.0270.06316.43
5.4.40.0270.06716.16
5.4.30.0330.06316.25
5.4.20.0230.06316.52
5.4.10.0200.03716.50
5.4.00.0170.07715.80
5.3.290.0330.06014.64
5.3.280.0330.04014.58
5.3.270.0200.05314.50
5.3.260.0270.03014.62
5.3.250.0200.04014.69
5.3.240.0270.06314.63
5.3.230.0230.05014.57
5.3.220.0230.05014.50
5.3.210.0270.06314.54
5.3.200.0230.07714.62
5.3.190.0200.03714.73
5.3.180.0200.04714.57
5.3.170.0170.03714.48
5.3.160.0270.04714.79
5.3.150.0230.06314.58
5.3.140.0270.06714.61
5.3.130.0270.06014.71
5.3.120.0200.06314.63
5.3.110.0200.04014.77
5.3.100.0270.05713.95
5.3.90.0170.04014.01
5.3.80.0270.06713.95
5.3.70.0300.06314.03
5.3.60.0200.05014.23
5.3.50.0230.05014.18
5.3.40.0170.04713.93
5.3.30.0230.04313.83
5.3.20.0170.06713.62
5.3.10.0230.06313.66
5.3.00.0270.06013.57
5.2.170.0130.03712.01
5.2.160.0200.04012.01
5.2.150.0200.03312.01
5.2.140.0130.05712.01
5.2.130.0200.06012.01
5.2.120.0130.04312.01
5.2.110.0230.03312.01
5.2.100.0230.04712.01
5.2.90.0230.05312.01
5.2.80.0200.04012.01
5.2.70.0170.03712.01
5.2.60.0230.03712.01
5.2.50.0100.06012.01
5.2.40.0170.03012.01
5.2.30.0170.05712.01
5.2.20.0170.05312.01
5.2.10.0200.03312.01
5.2.00.0200.05312.01
5.1.60.0270.04312.01
5.1.50.0130.05012.01
5.1.40.0100.05312.01
5.1.30.0170.05012.01
5.1.20.0130.04712.01
5.1.10.0100.05012.01
5.1.00.0200.04312.01
5.0.50.0070.04712.01
5.0.40.0070.03012.01
5.0.30.0100.05012.01
5.0.20.0130.03312.01
5.0.10.0070.02012.01
5.0.00.0100.02712.01
4.4.90.0100.03312.01
4.4.80.0070.03312.01
4.4.70.0100.01712.01
4.4.60.0100.03712.01
4.4.50.0070.03312.01
4.4.40.0130.03312.01
4.4.30.0070.02312.01
4.4.20.0070.02312.01
4.4.10.0070.03312.01
4.4.00.0100.03312.01
4.3.110.0130.03312.01
4.3.100.0100.03012.01
4.3.90.0100.01312.01
4.3.80.0070.02712.01
4.3.70.0100.02712.01
4.3.60.0100.02712.01
4.3.50.0100.02712.01
4.3.40.0100.04712.01
4.3.30.0070.02012.01
4.3.20.0030.03712.01
4.3.10.0100.03012.01
4.3.00.0030.04012.01

preferences:
151.84 ms | 1394 KiB | 7 Q