3v4l.org

run code in 300+ PHP versions simultaneously
<?php class dcl {public $property=2} 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)) { // 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.5.30.0100.07717.19
5.5.20.0100.06317.16
5.5.10.0100.04317.29
5.5.00.0030.04017.21
5.4.190.0030.07719.09
5.4.180.0030.07319.11
5.4.170.0100.03319.07
5.4.160.0070.03719.07
5.4.150.0070.06719.12
5.4.140.0070.06016.30
5.4.130.0030.04716.39
5.4.120.0030.04316.53
5.4.110.0070.08016.42
5.4.100.0070.07316.25
5.4.90.0130.07016.48
5.4.80.0030.07716.39
5.4.70.0070.04716.54
5.4.60.0030.07316.36
5.4.50.0070.03316.56
5.4.40.0100.06016.67
5.4.30.0100.07316.29
5.4.20.0070.07316.31
5.4.10.0000.05316.30
5.4.00.0070.06715.88
5.3.270.0130.03014.59
5.3.260.0100.03314.64
5.3.250.0030.06314.65
5.3.240.0030.08014.64
5.3.230.0130.06714.65
5.3.220.0070.07314.61
5.3.210.0070.05014.61
5.3.200.0000.07314.77
5.3.190.0130.06314.57
5.3.180.0100.07714.66
5.3.170.0030.07714.41
5.3.160.0030.06014.61
5.3.150.0000.04714.41
5.3.140.0070.07314.60
5.3.130.0100.07314.61
5.3.120.0100.08014.60
5.3.110.0070.06714.61
5.3.100.0030.05714.02
5.3.90.0030.07714.22
5.3.80.0170.05714.07
5.3.70.0030.06314.05
5.3.60.0130.04714.03
5.3.50.0000.04714.04
5.3.40.0100.07013.98
5.3.30.0070.03313.90
5.3.20.0030.03713.59
5.3.10.0130.06313.67
5.3.00.0030.06313.66

preferences:
139.03 ms | 1394 KiB | 7 Q