3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php trait BindableMethod { public function bindMethod($name, Closure $method, $overwrite = true) { if (method_exists($this, $name)) { return; } if ($overwrite === false && isset($this->$name)) { return; } $this->$name = \Closure::bind($method, $this, $this); } public function __call($method, $args) { if (isset($this->$method) && is_callable($this->$method)) { return call_user_func_array($this->$method, (array) $args); } } } class Foo { use BindableMethod; private $food = 'Tomatoes'; public function getFood() { return $this->food; } } $foo = new Foo(); $foo->bindMethod('changeToPickles', function(){ $this->food = 'pickles'; }); $foo->changeToPickles(); echo $foo->getFood();

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.170.0100.04312.38
5.4.160.0080.04412.38
5.4.150.0090.04212.37
5.4.140.0090.04312.06
5.4.130.0080.04112.04
5.4.120.0110.04012.01
5.4.110.0150.05012.00
5.4.100.0090.04012.00
5.4.90.0080.04112.00
5.4.80.0110.03812.00
5.4.70.0100.04112.00
5.4.60.0110.03712.00
5.4.50.0110.03912.00
5.4.40.0100.03911.99
5.4.30.0120.03511.98
5.4.20.0100.03711.98
5.4.10.0070.03911.98
5.4.00.0100.03811.48
5.3.270.0120.04412.72
5.3.260.0140.04512.72
5.3.250.0170.05712.72
5.3.240.0090.04112.72
5.3.230.0100.04112.71
5.3.220.0110.03912.68
5.3.210.0110.03912.68
5.3.200.0110.04012.68
5.3.190.0090.04512.68
5.3.180.0100.04912.67
5.3.170.0110.04012.67
5.3.160.0100.04112.67
5.3.150.0080.04412.67
5.3.140.0130.05112.66
5.3.130.0110.04612.66
5.3.120.0110.06112.66
5.3.110.0090.04812.66
5.3.100.0100.04612.12
5.3.90.0130.04512.08
5.3.80.0130.04812.07
5.3.70.0130.04812.07
5.3.60.0110.05012.06
5.3.50.0110.04812.00
5.3.40.0130.05912.00
5.3.30.0130.04511.94
5.3.20.0110.04311.73
5.3.10.0120.05411.69
5.3.00.0130.04111.68

preferences:
137.34 ms | 1394 KiB | 7 Q