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)) { // Assign the object to the static variable $obj = new stdclass(2); } $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.0030.07320.79
5.6.210.0070.04720.70
5.6.200.0100.03318.16
5.6.190.0030.06320.64
5.6.180.0030.04720.50
5.6.170.0200.03720.55
5.6.160.0030.05020.47
5.6.150.0000.04718.17
5.6.140.0030.05318.21
5.6.130.0070.08318.25
5.6.120.0170.08321.13
5.6.110.0100.08021.10
5.6.100.0100.07720.97
5.6.90.0100.07321.04
5.6.80.0100.07320.36
5.6.70.0100.04720.39
5.5.350.0030.08020.36
5.5.340.0030.04717.95
5.5.330.0130.07720.35
5.5.320.0070.03720.21
5.5.310.0300.07720.23
5.5.300.0030.09017.98
5.5.290.0100.06017.97
5.5.280.0130.07720.74
5.5.270.0130.07320.89
5.5.260.0070.07720.73
5.5.250.0070.05320.71
5.5.240.0000.07320.13
5.4.450.0330.04719.55
5.4.440.0300.05319.57
5.4.430.0430.05719.20
5.4.420.0230.05719.40
5.4.410.0470.06019.28
5.4.400.0330.05719.09
5.4.390.0400.06318.95
5.4.380.0230.05719.22
5.4.370.0630.06319.23
5.4.360.0270.07318.95
5.4.350.0270.06718.95
5.4.340.0500.05718.87
5.4.320.0200.07319.20
5.4.310.0330.04019.13
5.4.300.0300.06719.15
5.4.290.0200.06019.22
5.4.280.0470.04018.85
5.4.270.0230.06718.98
5.4.260.0200.03719.13
5.4.250.0200.07718.96
5.4.240.0270.07019.22
5.4.230.0300.05319.22
5.4.220.0330.03319.24
5.4.210.0370.04018.84
5.4.200.0270.04019.16
5.4.190.0370.04318.86
5.4.180.0300.05019.05
5.4.170.0170.04019.21
5.4.160.0230.04018.96
5.4.150.0130.04318.98
5.4.140.0200.03316.39
5.4.130.0170.04016.36
5.4.120.0230.03016.39
5.4.110.0130.03716.53
5.4.100.0200.03316.30
5.4.90.0130.04016.31
5.4.80.0100.04016.36
5.4.70.0170.03716.41
5.4.60.0170.03716.53
5.4.50.0200.03716.39
5.4.40.0200.03716.34
5.4.30.0200.03716.51
5.4.20.0170.03716.13
5.4.10.0130.04016.52
5.4.00.0170.03315.82
5.3.290.0230.07014.58
5.3.280.0270.06014.60
5.3.270.0200.04314.50
5.3.260.0200.04714.82
5.3.250.0200.04014.53
5.3.240.0170.03714.61
5.3.230.0130.04014.82
5.3.220.0230.03014.68
5.3.210.0100.04714.48
5.3.200.0070.04714.47
5.3.190.0200.03714.59
5.3.180.0100.04314.62
5.3.170.0100.04314.61
5.3.160.0370.03714.44
5.3.150.0270.03714.48
5.3.140.0170.04014.57
5.3.130.0200.03714.53
5.3.120.0200.04014.47
5.3.110.0230.03314.55
5.3.100.0170.05314.16
5.3.90.0200.03713.94
5.3.80.0200.03014.04
5.3.70.0230.04313.93
5.3.60.0230.03013.92
5.3.50.0370.03714.07
5.3.40.0130.03713.88
5.3.30.0170.03313.82
5.3.20.0230.02313.61
5.3.10.0230.04013.78
5.3.00.0230.04713.55
5.2.170.0100.03011.16
5.2.160.0170.02311.11
5.2.150.0130.03711.11
5.2.140.0000.04011.31
5.2.130.0400.02311.34
5.2.120.0100.03311.20
5.2.110.0170.02711.18
5.2.100.0270.04711.33
5.2.90.0300.03711.02
5.2.80.0200.03311.01
5.2.70.0200.03311.03
5.2.60.0270.04311.14
5.2.50.0230.05311.02
5.2.40.0200.03710.91
5.2.30.0200.06010.93
5.2.20.0230.04010.88
5.2.10.0170.05010.98
5.2.00.0230.03310.70
5.1.60.0130.04010.05
5.1.50.0170.05310.05
5.1.40.0230.03010.05
5.1.30.0200.05310.31
5.1.20.0170.04010.44
5.1.10.0230.05010.31
5.1.00.0230.05310.05
5.0.50.0100.03310.05
5.0.40.0130.04310.05
5.0.30.0100.06310.05
5.0.20.0130.03710.05
5.0.10.0170.03310.05
5.0.00.0200.05310.05
4.4.90.0130.01710.05
4.4.80.0100.02310.05
4.4.70.0100.03710.05
4.4.60.0130.03310.05
4.4.50.0130.02310.05
4.4.40.0100.05710.05
4.4.30.0130.02310.05
4.4.20.0100.01710.05
4.4.10.0170.01310.05
4.4.00.0070.03710.05
4.3.110.0100.03710.05
4.3.100.0100.03310.05
4.3.90.0170.02710.05
4.3.80.0100.03010.05
4.3.70.0070.02710.05
4.3.60.0100.03710.05
4.3.50.0170.01310.05
4.3.40.0100.03310.05
4.3.30.0000.02010.05
4.3.20.0100.02310.05
4.3.10.0030.04010.05
4.3.00.0070.03010.05

preferences:
142.43 ms | 1394 KiB | 7 Q