3v4l.org

run code in 300+ PHP versions simultaneously
<?php class obj implements arrayaccess { private $container = array(); public function __construct() { $this->container = array( "one" => 1, "two" => 2, "three" => 3, ); } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function offsetGet($offset) { var_dump($offset); return isset($this->container[$offset]) ? $this->container[$offset] : null; } } $obj = new obj; $obj[6][7] = 7 var_dump($obj["two"]["2"]); var_dump($obj["6"]["7"]);

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.80.0200.04512.02
5.4.70.0210.05712.01
5.4.60.0230.04012.01
5.4.50.0330.06412.01
5.4.40.0190.04412.00
5.4.30.0190.04612.00
5.4.20.0180.04311.99
5.4.10.0160.04711.99
5.4.00.0210.04211.49
5.3.180.0260.05912.67
5.3.170.0250.05612.67
5.3.160.0200.04912.67
5.3.150.0160.05012.67
5.3.140.0210.04612.66
5.3.130.0190.05012.66
5.3.120.0200.05112.65
5.3.110.0270.05812.66
5.3.100.0170.04812.13
5.3.90.0220.04712.11
5.3.80.0210.05812.10
5.3.70.0180.04912.10
5.3.60.0190.04612.08
5.3.50.0200.04412.03
5.3.40.0210.04612.03
5.3.30.0190.04512.00
5.3.20.0210.04511.78
5.3.10.0220.04111.74
5.3.00.0210.05711.72

preferences:
140.9 ms | 1399 KiB | 7 Q