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; $obj->property=2; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign the object to the static variable $obj = new stdclass; echo "aa".$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.280.0070.06721.13
5.6.210.0000.09320.57
5.6.200.0070.05718.18
5.6.190.0000.06020.48
5.6.180.0270.06720.57
5.6.170.0270.04320.71
5.6.160.0130.07020.46
5.6.150.0070.08318.18
5.6.140.0130.07718.18
5.6.130.0070.03718.21
5.6.120.0000.04321.08
5.6.110.0200.06720.97
5.6.100.0070.08720.98
5.6.90.0100.08020.98
5.6.80.0070.08320.29
5.5.350.4270.03720.30
5.5.340.0130.05018.10
5.5.330.0070.03720.43
5.5.320.0330.06320.27
5.5.310.0300.07720.20
5.5.300.0070.04017.95
5.5.290.0070.07317.95
5.5.280.0130.05020.88
5.5.270.0070.04320.97
5.5.260.0030.08320.90
5.5.250.0070.04320.59
5.5.240.0000.04720.13
5.4.450.0270.07719.51
5.4.440.0270.07319.55
5.4.430.0170.04019.54
5.4.420.0230.04319.27
5.4.410.0200.04719.19
5.4.400.0200.04318.95
5.4.390.0230.06019.15
5.4.380.0400.06019.01
5.4.370.0330.04019.09
5.4.360.0230.08019.09
5.4.350.0170.06319.23
5.4.340.0230.05319.13
5.4.320.0430.03319.24
5.4.310.0230.06019.13
5.4.300.0230.06319.20
5.4.290.0270.06318.86
5.4.280.0300.04018.87
5.4.270.0230.04719.08
5.4.260.0270.03319.22
5.4.250.0300.07318.97
5.4.240.0170.04719.15
5.4.230.0300.04719.14
5.4.220.0270.06019.21
5.4.210.0170.06019.21
5.4.200.0230.06719.13
5.4.190.0230.07019.30
5.4.180.0270.03719.14
5.4.170.0230.03718.86
5.4.160.0270.04319.12
5.4.150.0300.07018.97
5.4.140.0270.05016.43
5.4.130.0270.06716.37
5.4.120.0170.03716.40
5.4.110.0270.05716.60
5.4.100.0170.04016.32
5.4.90.0100.04316.50
5.4.80.0300.03316.58
5.4.70.0170.08316.49
5.4.60.0430.04016.38
5.4.50.0200.05316.44
5.4.40.0200.03716.47
5.4.30.0200.03716.34
5.4.20.0270.05016.51
5.4.10.0270.07016.51
5.4.00.0370.06015.90
5.3.290.0200.07314.69
5.3.280.0270.06714.68
5.3.270.0330.03314.51
5.3.260.0270.04714.59
5.3.250.0330.04014.66
5.3.240.0270.03014.58
5.3.230.0130.04714.50
5.3.220.0230.06014.54
5.3.210.0270.07314.63
5.3.200.0330.05314.57
5.3.190.0330.06314.57
5.3.180.0230.05314.59
5.3.170.0230.04314.62
5.3.160.0230.04714.56
5.3.150.0200.07314.65
5.3.140.0100.05014.64
5.3.130.0170.04314.53
5.3.120.0300.02714.48
5.3.110.0230.05314.48
5.3.100.0200.05714.20
5.3.90.0270.03014.11
5.3.80.0400.04013.93
5.3.70.0430.05313.93
5.3.60.0230.05013.93
5.3.50.0230.07013.88
5.3.40.0230.06714.05
5.3.30.0270.05013.89
5.3.20.0230.06313.92
5.3.10.0330.03713.70
5.3.00.0330.03313.87
5.2.170.0130.05012.15
5.2.160.0230.04312.15
5.2.150.0230.06012.15
5.2.140.0230.05312.15
5.2.130.0170.05312.15
5.2.120.0170.03012.15
5.2.110.0270.05012.15
5.2.100.0200.04012.15
5.2.90.0170.04312.15
5.2.80.0200.05012.15
5.2.70.0270.05712.15
5.2.60.0200.03312.15
5.2.50.0170.04312.15
5.2.40.0170.03712.15
5.2.30.0200.05712.15
5.2.20.0130.06012.15
5.2.10.0170.05712.15
5.2.00.0270.04012.15
5.1.60.0130.04312.15
5.1.50.0270.03012.15
5.1.40.0200.05012.15
5.1.30.0170.04312.15
5.1.20.0170.05312.15
5.1.10.0170.05012.15
5.1.00.0170.05312.15
5.0.50.0170.04012.15
5.0.40.0070.04712.15
5.0.30.0130.05712.15
5.0.20.0100.02312.15
5.0.10.0170.03712.15
5.0.00.0100.06012.15
4.4.90.0100.03012.15
4.4.80.0100.01712.15
4.4.70.0100.02712.15
4.4.60.0070.01712.15
4.4.50.0030.02012.15
4.4.40.0230.04312.15
4.4.30.0070.03012.15
4.4.20.0130.03312.15
4.4.10.0130.03012.15
4.4.00.0070.06012.15
4.3.110.0130.03012.15
4.3.100.0070.03712.15
4.3.90.0070.02712.15
4.3.80.0200.03012.15
4.3.70.0070.03012.15
4.3.60.0130.02312.15
4.3.50.0070.03712.15
4.3.40.0070.05312.15
4.3.30.0070.03012.15
4.3.20.0000.03012.15
4.3.10.0000.02712.15
4.3.00.0000.02712.15

preferences:
139.64 ms | 1398 KiB | 7 Q