3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Profile { private $active = false; public function activate() { $this->active = true; } public function isActive() { return $this->active; } } interface Event { function execute($object); } class ProfileWasActivated implements Event { public function execute($profile) { if(!($profileinstanceof Event)) { throw new \InvalidException('Only Profiles allowed!'); } $profile->activate(); } } class EventDomainObjectLoader { public static function load($object, array $events) { foreach($events as $event) { if(!($event instanceof Event)) { throw new \InvalidException('Only Events allowed!'); } $event->execute($object); } return $object; } } $profile = EventDomainObjectLoader::load(new Profile(), [new ProfileWasActivated()]); var_dump($profile->isActive());

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.340.0060.03712.04
5.4.320.0070.03812.52
5.4.310.0080.03712.52
5.4.300.0060.03812.53
5.4.290.0070.03912.52
5.4.280.0060.03812.41
5.4.270.0090.03712.41
5.4.260.0120.03612.41
5.4.250.0120.04812.41
5.4.240.0120.04712.41
5.4.230.0080.05512.40
5.4.220.0120.05712.40
5.4.210.0100.05212.41
5.4.200.0080.05412.40
5.4.190.0130.04012.40
5.4.180.0090.05012.40
5.4.170.0200.08012.41
5.4.160.0170.06812.40
5.4.150.0050.04112.41
5.4.140.0060.03712.09
5.4.130.0060.04812.07
5.4.120.0050.05112.04
5.4.110.0140.04712.03
5.4.100.0200.06312.04
5.4.90.0090.05612.03
5.4.80.0050.04612.03
5.4.70.0120.05112.04
5.4.60.0100.06112.03
5.4.50.0070.04812.03
5.4.40.0090.04412.02
5.4.30.0050.03912.02
5.4.20.0020.04312.01
5.4.10.0100.04712.02
5.4.00.0070.05211.51
5.3.290.0050.04512.80
5.3.280.0090.03612.70
5.3.270.0100.03612.73
5.3.260.0100.04612.72
5.3.250.0060.04312.72
5.3.240.0080.03812.72
5.3.230.0050.04112.71
5.3.220.0060.04412.68
5.3.210.0090.05012.68
5.3.200.0080.04412.68
5.3.190.0050.04512.68
5.3.180.0090.04412.67
5.3.170.0140.06412.67
5.3.160.0080.05712.68
5.3.150.0120.05212.67
5.3.140.0100.05112.66
5.3.130.0090.05812.66
5.3.120.0090.03712.66
5.3.110.0100.04412.65
5.3.100.0110.03612.13
5.3.90.0060.03812.11
5.3.80.0070.03612.10
5.3.70.0030.04212.10
5.3.60.0070.03712.09
5.3.50.0060.03712.03
5.3.40.0070.04012.05
5.3.30.0070.03511.99
5.3.20.0070.03411.77
5.3.10.0080.04011.74
5.3.00.0080.04111.72
5.2.170.0070.0419.23
5.2.160.0080.0419.22
5.2.150.0100.0319.23
5.2.140.0070.0349.22
5.2.130.0100.0379.19
5.2.120.0070.0389.19
5.2.110.0060.0319.19
5.2.100.0030.0309.19
5.2.90.0070.0279.19
5.2.80.0070.0309.18
5.2.70.0020.0379.19
5.2.60.0060.0349.13
5.2.50.0050.0369.10
5.2.40.0090.0309.08
5.2.30.0030.0359.06
5.2.20.0070.0309.04
5.2.10.0080.0338.95
5.2.00.0070.0388.82
5.1.60.0040.0338.09
5.1.50.0070.0308.10
5.1.40.0050.0318.07
5.1.30.0070.0338.43
5.1.20.0080.0338.45
5.1.10.0060.0308.17
5.1.00.0040.0318.17
5.0.50.0030.0216.65
5.0.40.0030.0216.51
5.0.30.0040.0306.32
5.0.20.0030.0206.29
5.0.10.0040.0196.27
5.0.00.0020.0316.26
4.4.90.0050.0124.78
4.4.80.0030.0154.75
4.4.70.0020.0174.75
4.4.60.0010.0184.76
4.4.50.0070.0134.77
4.4.40.0010.0314.71
4.4.30.0040.0174.76
4.4.20.0020.0174.85
4.4.10.0030.0164.85
4.4.00.0020.0264.75
4.3.110.0030.0164.67
4.3.100.0020.0164.66
4.3.90.0010.0164.63
4.3.80.0030.0244.58
4.3.70.0030.0144.63
4.3.60.0030.0154.63
4.3.50.0040.0204.63
4.3.40.0020.0254.54
4.3.30.0030.0153.30
4.3.20.0030.0203.28
4.3.10.0010.0173.24
4.3.00.0100.0236.74

preferences:
139.14 ms | 1394 KiB | 7 Q