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; echo 'Static object: '; var_dump($obj); if (!isset($obj)) {class dcl {public $property=2;} function &get_instance_ref() // Assign the object to the static variable $obj = new dcl; } $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.4.190.0180.04312.40
5.4.180.0170.04312.41
5.4.170.0140.04412.41
5.4.160.0200.06912.41
5.4.150.0120.04612.40
5.4.140.0130.04512.10
5.4.130.0120.04512.08
5.4.120.0150.04212.04
5.4.110.0160.04012.04
5.4.100.0140.04412.04
5.4.90.0150.04212.04
5.4.80.0170.04012.04
5.4.70.0150.04112.03
5.4.60.0160.04112.04
5.4.50.0140.04212.04
5.4.40.0160.04112.02
5.4.30.0300.08812.02
5.4.20.0170.04112.01
5.4.10.0110.04512.02
5.4.00.0120.04411.50
5.3.270.0110.04912.73
5.3.260.0160.04512.72
5.3.250.0250.09612.72
5.3.240.0130.04712.72
5.3.230.0100.05112.70
5.3.220.0160.04512.68
5.3.210.0190.04412.68
5.3.200.0190.04512.68
5.3.190.0190.04512.68
5.3.180.0210.04012.68
5.3.170.0290.09512.67
5.3.160.0200.04412.67
5.3.150.0250.03912.67
5.3.140.0180.04212.66
5.3.130.0200.04212.66
5.3.120.0130.05112.66
5.3.110.0410.08112.66
5.3.100.0160.04812.13
5.3.90.0200.04112.11
5.3.80.0160.04412.10
5.3.70.0120.04912.10
5.3.60.0170.04712.08
5.3.50.0350.08812.03
5.3.40.0400.08312.03
5.3.30.0330.08712.00
5.3.20.0360.08311.78
5.3.10.0200.03811.74
5.3.00.0340.08411.72

preferences:
138.39 ms | 1394 KiB | 7 Q