3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; } class Mapper { public function map(Kitchen $kitchen, array $data) { $mapper = $this; $map = function (Kitchen $kitchen, array $data) use ($mapper) { $mapper->setYummy($kitchen, $data); } $map = Closure::bind($map, null, $kitchen); $map($kitchen, $data); } public function setYummy(Kitchen $kitchen, array $data) { $kitchen->yummy = $data['yummy']; } } $kitchen = new Kitchen; $mapper = new Mapper; $mapper->map($kitchen, ['yummy' => 'cookie']); var_dump($kitchen); /* $sweetsThief = function (Kitchen $kitchen) { return $kitchen->yummy; }; $sweetsCop = function (Kitchen $kitchen, $yummy) { $kitchen->yummy = $yummy; }; $kitchen = new Kitchen(); $sweetsThief = Closure::bind($sweetsThief, null, $kitchen); $sweetsCop = Closure::bind($sweetsCop, null, $kitchen); var_dump($sweetsThief($kitchen)); $sweetsCop($kitchen, 'lie'); var_dump($sweetsThief($kitchen)); */

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.6.140.0070.04018.15
5.6.130.0070.03718.18
5.6.120.0070.06320.99
5.6.110.0100.08021.00
5.6.100.0100.07321.01
5.6.90.0070.06721.00
5.6.80.0070.07320.45
5.6.70.2630.04020.53
5.5.300.0030.05318.08
5.5.290.0070.05017.98
5.5.280.0030.05720.70
5.5.270.0030.04320.66
5.5.260.0030.04020.77
5.5.250.0130.07720.69
5.5.240.0070.07320.36
5.4.450.0270.05319.48
5.4.440.0300.07019.61
5.4.430.0200.06319.16
5.4.420.0230.05319.47
5.4.410.0330.05319.35
5.4.400.0270.04719.38
5.4.390.0130.07019.14
5.4.380.0270.05319.30
5.4.370.0230.05719.13
5.4.360.0170.06018.84
5.4.350.0230.05019.01
5.4.340.0230.05719.15
5.4.320.0130.06719.32
5.4.310.0200.05719.15
5.4.300.0130.06019.06
5.4.290.0130.08019.30
5.4.280.0200.05719.26
5.4.270.0230.07019.01
5.4.260.0400.06019.15
5.4.250.0200.06719.38
5.4.240.0170.08319.16
5.4.230.0330.04719.28
5.4.220.0330.08319.27
5.4.210.0300.07318.97
5.4.200.0330.06018.86
5.4.190.0170.05319.07
5.4.180.0330.05319.14
5.4.170.0330.06318.87
5.4.160.0100.06319.27
5.4.150.0170.07019.04
5.4.140.0230.05716.52
5.4.130.0400.05016.46
5.4.120.0230.04316.40
5.4.110.0270.05016.66
5.4.100.0330.05316.66
5.4.90.0230.05716.47
5.4.80.0370.03716.68
5.4.70.0200.03316.39
5.4.60.0270.07316.52
5.4.50.0000.04716.49
5.4.40.0000.04716.17
5.4.30.0030.06716.23
5.4.20.0030.06716.42

preferences:
138.99 ms | 1398 KiB | 7 Q