3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PieceOfSheet { private $cells = []; function add($name, $value) { $this->cells[$name] = $value; } function get($name) { return $this->cells[$name]; } function all() { return $this->cells; } } class Person { public $name; public $age; public $gender; public $from; function __construct($name, $age, $gender, $from) { $this->name = $name; $this->age = $age; $this->gender = $gender; $this->from = $from; } } class StuffDoer { private $sheet; function __construct(PieceOfSheet $sheet) { $this->sheet = $sheet; } function doStuff() { $data = [ 'prathna' => function (Person $person) { return $person->name; }, 'chris' => function (Person $person) { return $person->gender; }, 'adam' => function (Person $person) { return $person->from; }, 'deepthi' => function (Person $person) { return $this->age; } ]; foreach (['adam', 'chris', 'prathna'] as $name) { $this->addMoreSheet($this->sheet, $data[$name]); } return $this->sheet->all(); } function addMoreSheet(PieceOfSheet $sheet, $cell, callable $getData, Person $person) { $sheet->add($cell, call_user_func_array($getData, [$person]); } } $s = new StuffDoer(new PieceOfSheet()); var_dump($s->doStuff());

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)
7.0.00.0070.07320.24
5.6.160.0130.07720.46
5.6.150.0070.07318.22
5.6.140.0070.08018.19
5.6.130.0130.07318.28
5.6.120.0070.08321.07
5.6.110.0030.08321.13
5.6.100.0170.07321.13
5.6.90.0030.06320.87
5.6.80.0100.07320.40
5.5.300.0030.04017.99
5.5.290.0030.04017.94
5.5.280.0030.05320.77
5.5.270.0130.06020.79
5.5.260.0030.04020.88
5.5.250.0070.07720.60
5.5.240.0130.07720.18

preferences:
132.59 ms | 1398 KiB | 8 Q