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)) {$a=2; // Assign the object to the static variable $obj = new stdclass($this->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.280.0000.07721.06
5.6.210.0130.07320.70
5.6.200.0000.04718.19
5.6.190.0100.05020.77
5.6.180.0270.06020.57
5.6.170.0370.06320.56
5.6.160.0030.04720.56
5.6.150.0230.06318.16
5.6.140.0030.04318.17
5.6.130.0070.04718.18
5.6.120.0100.08021.04
5.6.110.0000.04321.14
5.6.100.0030.04021.02
5.6.90.0130.07320.98
5.6.80.0070.04020.38
5.6.70.0200.06720.54
5.5.350.4130.04320.43
5.5.340.0100.07718.05
5.5.330.0130.05020.32
5.5.320.0270.04720.38
5.5.310.0270.06720.23
5.5.300.0100.07017.98
5.5.290.0030.06717.93
5.5.280.0100.08320.99
5.5.270.0100.08320.80
5.5.260.0070.08720.87
5.5.250.0100.03720.59
5.5.240.0100.08020.27
5.4.450.0170.07019.54
5.4.440.0030.04319.42
5.4.430.0170.03719.32
5.4.420.0200.05319.27
5.4.410.0030.04319.36
5.4.400.0170.07018.86
5.4.390.0070.03718.85
5.4.380.0100.03718.92
5.4.370.0100.03319.12
5.4.360.0070.05718.85
5.4.350.0100.03719.08
5.4.340.0070.04719.14
5.4.320.0070.04019.15
5.4.310.0070.05019.01
5.4.300.0070.07719.15
5.4.290.0030.04319.24
5.4.280.0070.04018.92
5.4.270.0130.04719.20
5.4.260.0070.05019.24
5.4.250.0030.06019.12
5.4.240.0100.07019.02
5.4.230.0030.07319.23
5.4.220.0070.08018.86
5.4.210.0130.07019.25
5.4.200.0070.08019.00
5.4.190.0030.08019.07
5.4.180.0230.04019.07
5.4.170.0100.05019.19
5.4.160.0130.04719.23
5.4.150.0070.07018.83
5.4.140.0030.05016.46
5.4.130.0030.08016.42
5.4.120.0030.07716.51
5.4.110.0030.08016.36
5.4.100.0100.06016.71
5.4.90.0130.06716.44
5.4.80.0030.07016.46
5.4.70.0100.04016.51
5.4.60.0030.05016.37
5.4.50.0030.03716.47
5.4.40.0070.04716.42
5.4.30.0070.04316.43
5.4.20.0070.04316.64
5.4.10.0030.05316.38
5.4.00.0230.05715.86
5.3.290.0000.05014.72
5.3.280.0070.07714.67
5.3.270.0000.05314.63
5.3.260.0030.04314.66
5.3.250.0070.07314.78
5.3.240.0070.05714.67
5.3.230.0130.07014.61
5.3.220.0030.03714.73
5.3.210.0130.07014.62
5.3.200.0070.04714.62
5.3.190.0100.06714.57
5.3.180.0000.05714.71
5.3.170.0070.06714.63
5.3.160.0070.03314.56
5.3.150.0070.06714.60
5.3.140.0070.03714.61
5.3.130.0100.07714.55
5.3.120.0030.08314.63
5.3.110.0070.07714.55
5.3.100.0030.07714.09
5.3.90.0130.03314.11
5.3.80.0030.05714.02
5.3.70.0030.04714.02
5.3.60.0000.04314.05
5.3.50.0000.04714.12
5.3.40.0000.04314.01
5.3.30.0070.07013.83
5.3.20.0030.04713.62
5.3.10.0070.03313.66
5.3.00.0070.05313.57
5.2.170.0070.02711.20
5.2.160.0000.03311.15
5.2.150.0030.04311.12
5.2.140.0030.04711.14
5.2.130.0070.06011.11
5.2.120.0070.06011.04
5.2.110.0000.03311.07
5.2.100.0130.04011.14
5.2.90.0030.05311.18
5.2.80.0030.04011.11
5.2.70.0100.02711.06
5.2.60.0070.03311.02
5.2.50.0000.04010.98
5.2.40.0030.03711.00
5.2.30.0070.05310.95
5.2.20.0000.03711.02
5.2.10.0130.05011.02
5.2.00.0170.04710.74
5.1.60.0030.02310.03
5.1.50.0000.02710.07
5.1.40.0070.03710.00
5.1.30.0030.06010.32
5.1.20.0030.03010.39
5.1.10.0070.04010.12
5.1.00.0100.05010.06
5.0.50.0030.0278.62
5.0.40.0100.0278.39
5.0.30.0000.0438.36
5.0.20.0000.0478.36
5.0.10.0030.0278.36
5.0.00.0000.0608.36
4.4.90.0000.0178.36
4.4.80.0070.0278.36
4.4.70.0130.0138.36
4.4.60.0070.0138.36
4.4.50.0000.0178.36
4.4.40.0000.0578.36
4.4.30.0070.0138.36
4.4.20.0000.0338.36
4.4.10.0000.0378.36
4.4.00.0030.0308.36
4.3.110.0030.0238.36
4.3.100.0030.0338.36
4.3.90.0070.0308.36
4.3.80.0000.0538.36
4.3.70.0000.0338.36
4.3.60.0070.0308.36
4.3.50.0000.0278.36
4.3.40.0000.0408.36
4.3.30.0000.0308.36
4.3.20.0000.0308.36
4.3.10.0070.0308.36
4.3.00.0030.0238.36

preferences:
142.54 ms | 1394 KiB | 7 Q