3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Kitchen { private $yummy = 'cake'; } class MapperX { 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']; } } class Mapper { public function setYummy(Kitchen $kitchen, array $data) { return function (Kitchen $kitchen) { $kitchen->yummy = $data['yummy']; } } } $kitchen = new Kitchen; $mapper = new Mapper; $clj = $mapper->setYummy($kitchen, ['yummy' => 'cookie']); $clj->bindTo($kitchen); $clj(); 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.0100.07018.14
5.6.130.0130.03318.22
5.6.120.0130.08020.91
5.6.110.0070.07320.99
5.6.100.0030.05721.01
5.6.90.0070.04021.00
5.6.80.0100.08020.44
5.6.70.4370.03720.52
5.5.300.0070.08017.93
5.5.290.0030.07017.98
5.5.280.0070.08320.79
5.5.270.0030.09020.66
5.5.260.0100.07720.78
5.5.250.0070.04020.81
5.5.240.0270.07320.27
5.4.450.0500.05719.71
5.4.440.0200.04719.20
5.4.430.0030.07319.60
5.4.420.0170.04719.49
5.4.410.0500.06019.33
5.4.400.0600.06319.29
5.4.390.0700.06718.87
5.4.380.0630.05319.13
5.4.370.0730.06019.15
5.4.360.0800.04719.15
5.4.350.0630.05319.29
5.4.340.0700.06019.07
5.4.320.0700.06019.37
5.4.310.0730.05319.16
5.4.300.0670.05318.86
5.4.290.0670.05019.16
5.4.280.0670.05718.84
5.4.270.0730.04719.12
5.4.260.0630.05319.39
5.4.250.0630.05318.86
5.4.240.0670.05719.29
5.4.230.0630.05319.02
5.4.220.0700.05718.97
5.4.210.0700.06319.00
5.4.200.0670.05719.39
5.4.190.0730.05318.86
5.4.180.0730.05319.27
5.4.170.0730.04719.20
5.4.160.0730.05319.13
5.4.150.0830.04319.04
5.4.140.0770.04716.60
5.4.130.0830.03716.54
5.4.120.0800.04016.44
5.4.110.0700.05316.66
5.4.100.0830.04716.70
5.4.90.0830.04016.66
5.4.80.0770.04716.64
5.4.70.0130.06016.60
5.4.60.0270.04316.39
5.4.50.0100.06716.44
5.4.40.0000.07016.25
5.4.30.0000.03716.42
5.4.20.0230.04316.54

preferences:
145.93 ms | 1394 KiB | 7 Q