3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function __construct (&$arr) { $this->arr = &$arr; } function createInstance () { $reflectionClass = new ReflectionClass("Bar"); return $reflectionClass->newInstanceArgs(array($this, $this- >arr)); } function mod($key, $val) { $this->arr[$key] = $val; } } class Bar { function __construct (&$foo, &$arr) { $this->foo = &$foo; $this->arr = &$arr; } function mod($key, $val) { $this->arr[$key] = $val; } } $arr = array(); $foo = new Foo($arr); $arr["x"] = 1; $foo->mod("y", 2); $bar = $foo->createInstance(); $bar->mod("z", 3); var_dump($arr,$foo,$bar);

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.60.0180.04212.00
5.4.50.0160.04512.00
5.4.40.0210.05511.99
5.4.30.0140.04711.99
5.4.20.0170.04411.99
5.4.10.0180.04311.99
5.4.00.0160.04911.48
5.3.160.0340.07512.68
5.3.150.0500.04312.67
5.3.140.0210.04312.66
5.3.130.0170.04812.66
5.3.120.0210.04412.66
5.3.110.0160.04812.66
5.3.100.0160.04712.12
5.3.90.0190.04412.10
5.3.80.0170.04612.09
5.3.70.0150.05012.09
5.3.60.0160.04712.07
5.3.50.0160.04712.02
5.3.40.0300.06412.02
5.3.30.0210.04011.98
5.3.20.0180.04311.77
5.3.10.0160.04211.73
5.3.00.0310.07511.71

preferences:
154.36 ms | 1399 KiB | 7 Q