3v4l.org

run code in 300+ PHP versions simultaneously
<?phpz 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)
8.3.60.0150.00616.63
8.3.50.0140.00721.14
8.3.40.0070.01318.63
8.3.30.0040.01118.69
8.3.20.0110.00320.21
8.3.10.0040.00821.73
8.3.00.0060.00323.65
8.2.180.0150.00617.89
8.2.170.0090.00618.91
8.2.160.0060.01322.96
8.2.150.0050.00225.66
8.2.140.0060.00324.66
8.2.130.0060.00319.72
8.2.120.0080.00026.35
8.2.110.0040.00422.13
8.2.100.0040.00717.80
8.2.90.0050.00319.12
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0050.00317.79
8.2.50.0000.00818.07
8.2.40.0070.00020.52
8.2.30.0080.00020.75
8.2.20.0050.00317.45
8.2.10.0000.00718.00
8.2.00.0040.00417.93
8.1.280.0060.00925.92
8.1.270.0000.00823.83
8.1.260.0000.00828.09
8.1.250.0070.00028.09
8.1.240.0030.00920.45
8.1.230.0120.00019.02
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0030.00617.23
8.1.190.0080.00017.10
8.1.180.0000.00718.10
8.1.170.0050.00318.55
8.1.160.0060.00320.60
8.1.150.0070.00018.77
8.1.140.0000.00819.52
8.1.130.0000.00717.58
8.1.120.0000.00717.23
8.1.110.0070.00017.30
8.1.100.0070.00017.19
8.1.90.0000.00717.25
8.1.80.0000.00717.23
8.1.70.0030.00317.24
8.1.60.0000.00817.51
8.1.50.0000.00917.41
8.1.40.0000.00817.39
8.1.30.0000.00817.43
8.1.20.0040.00417.57
8.1.10.0000.00817.37
8.1.00.0070.00017.36
8.0.300.0050.00218.77
8.0.290.0000.00716.63
8.0.280.0000.00718.31
8.0.270.0000.00717.25
8.0.260.0000.00617.23
8.0.250.0030.00316.80
8.0.240.0030.00316.89
8.0.230.0000.00716.86
8.0.220.0030.00316.76
8.0.210.0040.00416.63
8.0.200.0040.00416.77
8.0.190.0000.00816.74
8.0.180.0070.00016.83
8.0.170.0060.00316.65
8.0.160.0030.00316.64
8.0.150.0040.00416.84
8.0.140.0040.00416.65
8.0.130.0060.00013.43
8.0.120.0040.00416.79
8.0.110.0040.00416.78
8.0.100.0000.00816.84
8.0.90.0000.00716.66
8.0.80.0080.00716.82
8.0.70.0040.00416.64
8.0.60.0000.00716.77
8.0.50.0040.00416.77
8.0.30.0070.01017.00
8.0.20.0110.01217.40
8.0.10.0040.00416.94
8.0.00.0070.01016.61
7.4.330.0060.00016.83
7.4.320.0000.00616.25
7.4.300.0000.00816.49
7.4.290.0000.01016.49
7.4.280.0060.00316.33
7.4.270.0080.00016.48
7.4.260.0060.00316.36
7.4.250.0000.00816.33
7.4.240.0000.00716.45
7.4.230.0070.00016.30
7.4.220.0060.01516.40
7.4.210.0110.00316.59
7.4.200.0000.00716.60
7.4.160.0100.00616.34
7.4.150.0110.00917.40
7.4.140.0100.00717.86
7.4.130.0120.00916.47
7.4.120.0080.00916.49
7.4.110.0070.01016.42
7.4.100.0080.00916.30
7.4.90.0100.01016.44
7.4.80.0060.01019.39
7.4.70.0160.00316.47
7.4.60.0140.00416.47
7.4.50.0030.01316.48
7.4.40.0070.01016.38
7.4.30.0140.00316.43
7.3.330.0020.00213.23
7.3.320.0000.00513.17
7.3.310.0000.00715.98
7.3.300.0000.00816.18
7.3.290.0060.00916.14
7.3.280.0110.00516.17
7.3.270.0070.01117.40
7.3.260.0130.01016.31
7.3.250.0060.01116.22
7.3.240.0070.00916.28
7.3.230.0100.00716.45
7.3.210.0100.00716.17
7.3.200.0130.01119.39
7.3.190.0030.01316.44
7.3.180.0150.00016.28
7.3.170.0130.00316.32
7.3.160.0090.00616.48
7.2.330.0040.01416.32
7.2.320.0120.00916.16
7.2.310.0100.01416.62
7.2.300.0070.01016.27
7.2.290.0060.01216.45
7.0.00.0170.07720.06
5.6.160.0030.09020.54
5.6.150.0070.08018.21
5.6.140.0170.05318.14
5.6.130.0070.07018.28
5.6.120.0200.05721.14
5.6.110.0100.08021.02
5.6.100.0100.08021.13
5.6.90.0170.07021.09
5.6.80.0070.08020.48
5.5.300.0100.04718.00
5.5.290.0030.04018.08
5.5.280.0070.05720.84
5.5.270.0100.03720.97
5.5.260.0000.04720.67
5.5.250.0070.08020.68
5.5.240.0170.03720.15

preferences:
30.53 ms | 401 KiB | 5 Q