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->property=2; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign the object to the static variable $obj = new stdclass; echo $property; } $obj->self::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.4.190.0100.04212.40
5.4.180.0090.04312.40
5.4.170.0090.04312.41
5.4.160.0100.04212.40
5.4.150.0100.04212.40
5.4.140.0130.03912.09
5.4.130.0120.03912.07
5.4.120.0090.04112.04
5.4.110.0090.04212.03
5.4.100.0110.03912.03
5.4.90.0090.04512.03
5.4.80.0120.04312.03
5.4.70.0110.04212.03
5.4.60.0120.03912.03
5.4.50.0100.04012.03
5.4.40.0130.03812.02
5.4.30.0120.04012.01
5.4.20.0100.03912.01
5.4.10.0110.03812.01
5.4.00.0110.03911.50
5.3.270.0100.04412.72
5.3.260.0240.06012.72
5.3.250.0110.04112.72
5.3.240.0120.04212.72
5.3.230.0100.04412.71
5.3.220.0110.04112.68
5.3.210.0120.04312.68
5.3.200.0150.05312.68
5.3.190.0090.04312.68
5.3.180.0130.04112.67
5.3.170.0160.03912.67
5.3.160.0120.04212.67
5.3.150.0140.05312.67
5.3.140.0130.04012.66
5.3.130.0120.04312.65
5.3.120.0120.04312.66
5.3.110.0250.06312.66
5.3.100.0110.04212.13
5.3.90.0210.06112.11
5.3.80.0110.04112.09
5.3.70.0110.03912.10
5.3.60.0090.04212.08
5.3.50.0100.04012.03
5.3.40.0130.04212.03
5.3.30.0130.03611.99
5.3.20.0100.04011.77
5.3.10.0120.03911.73
5.3.00.0090.04011.72

preferences:
131.92 ms | 1386 KiB | 7 Q