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; $obj=2; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign the object to the static variable $obj->property = new stdclass; } $obj->property++; return $obj->property; } $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.0000.07720.82
5.6.210.0030.04020.54
5.6.200.0070.06718.15
5.6.190.0100.06320.67
5.6.180.0230.07720.39
5.6.170.0330.07320.71
5.6.160.0000.08320.46
5.6.150.0070.03718.29
5.6.140.0100.08018.18
5.6.130.0170.07718.29
5.6.120.0070.09020.88
5.6.110.0030.08321.12
5.6.100.0130.07720.99
5.6.90.0030.05720.96
5.6.80.0070.04720.26
5.6.70.3170.04320.38
5.5.350.0130.04320.35
5.5.340.0070.07317.93
5.5.330.0130.05020.16
5.5.320.0100.08320.14
5.5.310.0270.07320.24
5.5.300.0100.07017.93
5.5.290.0070.08018.05
5.5.280.0100.04020.91
5.5.270.0100.08320.96
5.5.260.0030.04020.89
5.5.250.0070.03720.80
5.5.240.0230.07720.04
5.4.450.0030.08719.33
5.4.440.0100.07719.14
5.4.430.0070.07319.32
5.4.420.0100.07319.50
5.4.410.0130.07019.37
5.4.400.0070.06718.88
5.4.390.0070.06719.09
5.4.380.0070.07718.93
5.4.370.0100.07319.08
5.4.360.0070.07019.06
5.4.350.0030.08018.95
5.4.340.0100.04018.94
5.4.320.0100.03319.08
5.4.310.0070.03719.00
5.4.300.0130.06019.06
5.4.290.0030.04019.09
5.4.280.0070.06318.96
5.4.270.0070.05019.09
5.4.260.0070.04719.02
5.4.250.0030.04319.02
5.4.240.0030.07019.01
5.4.230.0170.06719.09
5.4.220.0100.06318.79
5.4.210.0030.07718.85
5.4.200.0030.04319.07
5.4.190.0100.07318.96
5.4.180.0170.03319.05
5.4.170.0100.07019.07
5.4.160.0070.06319.00
5.4.150.0070.06719.16
5.4.140.0100.06716.44
5.4.130.0000.05016.24
5.4.120.0070.07016.27
5.4.110.0070.04316.48
5.4.100.0100.03716.37
5.4.90.0130.04016.27
5.4.80.0100.07016.23
5.4.70.0100.05316.39
5.4.60.0070.07016.44
5.4.50.0030.04016.34
5.4.40.0000.04016.43
5.4.30.0030.03716.43
5.4.20.0070.06016.38
5.4.10.0100.07316.34
5.4.00.0030.04015.76
5.3.290.0030.04014.52
5.3.280.0000.04314.53
5.3.270.0130.07314.48
5.3.260.0130.07014.36
5.3.250.0030.06714.35
5.3.240.0130.06714.59
5.3.230.0030.05714.44
5.3.220.0100.06314.43
5.3.210.0170.05314.44
5.3.200.0030.04714.48
5.3.190.0070.07714.43
5.3.180.0130.05314.42
5.3.170.0130.04014.45
5.3.160.0100.06314.41
5.3.150.0070.05014.39
5.3.140.0030.03714.41
5.3.130.0100.04014.30
5.3.120.0100.07714.39
5.3.110.0070.06314.39
5.3.100.0000.04713.88
5.3.90.0030.06313.96
5.3.80.0130.06013.85
5.3.70.0130.03713.81
5.3.60.0070.06713.88
5.3.50.0070.06713.79
5.3.40.0070.06313.64
5.3.30.0070.03313.72
5.3.20.0070.06713.51
5.3.10.0100.06713.44
5.3.00.0130.04013.56
5.2.170.0070.05311.19
5.2.160.0000.05311.32
5.2.150.0000.06311.23
5.2.140.0070.06311.20
5.2.130.0100.06011.11
5.2.120.0030.05011.16
5.2.110.0030.05711.14
5.2.100.0030.03711.16
5.2.90.0070.05311.27
5.2.80.0030.05711.14
5.2.70.0130.05711.16
5.2.60.0100.06311.20
5.2.50.0030.05011.02
5.2.40.0030.06311.01
5.2.30.0030.05310.86
5.2.20.0070.06010.96
5.2.10.0100.04710.91
5.2.00.0070.05710.54
5.1.60.0030.0309.86
5.1.50.0030.0409.84
5.1.40.0000.0309.77
5.1.30.0030.02710.18
5.1.20.0030.03310.19
5.1.10.0030.0439.91
5.1.00.0030.0609.98
5.0.50.0100.0208.62
5.0.40.0000.0438.41
5.0.30.0030.0308.20
5.0.20.0030.0238.22
5.0.10.0000.0208.14
5.0.00.0030.0308.21
4.4.90.0070.0337.88
4.4.80.0030.0277.88
4.4.70.0000.0377.88
4.4.60.0000.0377.88
4.4.50.0000.0277.88
4.4.40.0070.0237.88
4.4.30.0030.0237.88
4.4.20.0030.0337.88
4.4.10.0070.0207.88
4.4.00.0000.0537.88
4.3.110.0070.0337.88
4.3.100.0030.0377.88
4.3.90.0030.0137.88
4.3.80.0000.0307.88
4.3.70.0000.0407.88
4.3.60.0030.0307.88
4.3.50.0000.0377.88
4.3.40.0030.0477.88
4.3.30.0030.0377.88
4.3.20.0030.0277.88
4.3.10.0000.0377.88
4.3.00.0000.0377.88

preferences:
139.67 ms | 1394 KiB | 7 Q