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=2; echo 'Static object: '; if (!isset($obj)) { // Assign the object to the static variable $obj = new stdclass; } $obj->property++; echo $property; return $property; } $obj1 = get_instance_ref(); $still_obj1 = get_instance_ref(); echo "\n"; $obj2 = get_instance_noref(); $still_obj2 = get_instance_noref(); $still_obj2 = 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.04
5.6.210.0030.04320.57
5.6.200.0030.04318.29
5.6.190.0030.06320.67
5.6.180.0270.07320.52
5.6.170.0230.06320.56
5.6.160.0100.07020.44
5.6.150.0100.08018.14
5.6.140.0070.06718.18
5.6.130.0070.07018.25
5.6.120.0070.09020.98
5.6.110.0100.07321.02
5.6.100.0070.08720.98
5.6.90.0070.06021.00
5.6.80.0030.04320.52
5.6.70.4570.03320.38
5.5.350.0130.07720.45
5.5.340.0070.08017.98
5.5.330.0070.08720.41
5.5.320.0130.07320.35
5.5.310.0170.04020.19
5.5.300.0070.05018.05
5.5.290.0130.05018.04
5.5.280.0100.04320.66
5.5.270.0000.04320.90
5.5.260.0100.07720.98
5.5.250.0330.06320.50
5.5.240.0200.06020.24
5.4.450.0330.04719.46
5.4.440.0300.02719.64
5.4.430.0230.04019.16
5.4.420.0200.04319.27
5.4.410.0330.04719.03
5.4.400.0270.03319.32
5.4.390.0370.03719.11
5.4.380.0270.03719.11
5.4.370.0200.04319.18
5.4.360.0200.04019.11
5.4.350.0270.04019.22
5.4.340.0270.03719.14
5.4.320.0200.04719.22
5.4.310.0270.04019.20
5.4.300.0230.05019.11
5.4.290.0170.05719.13
5.4.280.0130.05019.11
5.4.270.0170.04319.13
5.4.260.0130.07319.11
5.4.250.0170.07719.21
5.4.240.0300.03719.11
5.4.230.0270.03719.13
5.4.220.0270.04019.11
5.4.210.0270.04019.21
5.4.200.0230.03319.11
5.4.190.0230.04019.11
5.4.180.0270.03319.12
5.4.170.0230.04019.15
5.4.160.0270.03719.11
5.4.150.0170.03719.11
5.4.140.0300.03719.11
5.4.130.0200.04319.11
5.4.120.0130.04719.11
5.4.110.0230.03719.11
5.4.100.0330.03319.11
5.4.90.0370.06319.11
5.4.80.0300.03019.11
5.4.70.0270.04019.11
5.4.60.0200.04319.11
5.4.50.0170.05319.11
5.4.40.0170.04019.11
5.4.30.0100.05319.11
5.4.20.0230.05019.11
5.4.10.0100.04019.11
5.4.00.0200.03019.11
5.3.290.0200.05019.11
5.3.280.0270.04019.11
5.3.270.0200.04319.11
5.3.260.0430.02319.11
5.3.250.0200.04019.11
5.3.240.0270.03319.11
5.3.230.0230.04319.11
5.3.220.0300.02719.11
5.3.210.0330.04019.11
5.3.200.0130.03719.11
5.3.190.0230.05319.11
5.3.180.0270.03319.11
5.3.170.0270.04019.11
5.3.160.0170.03719.11
5.3.150.0300.04019.11
5.3.140.0270.03719.11
5.3.130.0130.05319.11
5.3.120.0200.03719.11
5.3.110.0230.04319.11
5.3.100.0170.06019.11
5.3.90.0230.03719.11
5.3.80.0200.04019.11
5.3.70.0200.05019.11
5.3.60.0230.03019.11
5.3.50.0200.04019.11
5.3.40.0230.03319.11
5.3.30.0300.06319.11
5.3.20.0300.06019.11
5.3.10.0200.02719.11
5.3.00.0170.03319.11
5.2.170.0170.03719.11
5.2.160.0270.02319.11
5.2.150.0170.02719.11
5.2.140.0200.02319.11
5.2.130.0230.02319.11
5.2.120.0170.04319.11
5.2.110.0130.02719.11
5.2.100.0230.02019.11
5.2.90.0200.03019.11
5.2.80.0200.05319.11
5.2.70.0200.02319.11
5.2.60.0170.03019.11
5.2.50.0200.02719.11
5.2.40.0130.04319.11
5.2.30.0130.03719.11
5.2.20.0130.02719.11
5.2.10.0130.02019.11
5.2.00.0130.04019.11
5.1.60.0100.02319.11
5.1.50.0170.03319.11
5.1.40.0200.02019.11
5.1.30.0170.03719.11
5.1.20.0270.03019.11
5.1.10.0100.03019.11
5.1.00.0170.02719.11
5.0.50.0070.01719.11
5.0.40.0100.02019.11
5.0.30.0070.03319.11
5.0.20.0070.02319.11
5.0.10.0100.01719.11
5.0.00.0100.02319.11
4.4.90.0070.01719.11
4.4.80.0100.01319.11
4.4.70.0100.01319.11
4.4.60.0070.02319.11
4.4.50.0100.01319.11
4.4.40.0030.02719.11
4.4.30.0100.02019.11
4.4.20.0000.02019.11
4.4.10.0070.02319.11
4.4.00.0070.02719.11
4.3.110.0170.01319.11
4.3.100.0070.01719.11
4.3.90.0100.01019.11
4.3.80.0000.03019.11
4.3.70.0070.01319.11
4.3.60.0030.02019.11
4.3.50.0000.02019.11
4.3.40.0070.02319.11
4.3.30.0030.01319.11
4.3.20.0030.03719.11
4.3.10.0030.01719.11
4.3.00.0070.01319.11

preferences:
142.45 ms | 1394 KiB | 7 Q