3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &get_instance_ref() { static $obj; public property ='a'; 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; public property ='a'; echo 'Static object: '; var_dump($obj); if (!isset($obj)) { // Assign the object to the static variable $obj = new stdclass; } $obj->property++; return $obj; } $obj1 = get_instance_ref(); $still_obj1 = get_instance_ref(); echo "\n"; $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.4.190.0170.03719.05
5.4.180.0170.03719.21
5.4.170.0200.03018.99
5.4.160.0130.04019.14
5.4.150.0300.06319.20
5.4.140.0200.06316.37
5.4.130.0130.03716.34
5.4.120.0230.06716.31
5.4.110.0130.04016.56
5.4.100.0230.05316.45
5.4.90.0270.03016.28
5.4.80.0200.03716.35
5.4.70.0170.03716.55
5.4.60.0230.05016.38
5.4.50.0270.06016.53
5.4.40.0370.06316.55
5.4.30.0230.04316.18
5.4.20.0270.05716.55
5.4.10.0230.06016.34
5.4.00.0230.06015.75
5.3.270.0270.07014.61
5.3.260.0230.05014.68
5.3.250.0200.05714.58
5.3.240.0230.04314.52
5.3.230.0230.07014.62
5.3.220.0200.07314.65
5.3.210.0230.04714.54
5.3.200.0200.06314.54
5.3.190.0270.05014.48
5.3.180.0130.04714.79
5.3.170.0230.03314.48
5.3.160.0200.03314.68
5.3.150.0130.04314.48
5.3.140.0170.04714.62
5.3.130.0200.03714.64
5.3.120.0200.03714.46
5.3.110.0270.06714.70
5.3.100.0200.04014.19
5.3.90.0270.03313.93
5.3.80.0270.06713.94
5.3.70.0200.05314.02
5.3.60.0230.04313.92
5.3.50.0200.07014.02
5.3.40.0230.04013.87
5.3.30.0200.04313.98
5.3.20.0070.04313.71
5.3.10.0230.05013.55
5.3.00.0170.04013.64

preferences:
142.43 ms | 1394 KiB | 7 Q