3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class DomainEvent { private static $events = []; /** * @var \DateTime */ private $occurredOn; private function __construct() { static::addEvent($this); $this->occurredOn = new \DateTime(); } public static function trigger(...$args) { $event = new static(); $event->instantiate(...$args); return $event; } abstract protected function instantiate(...$args); private static function addEvent($event) { self::$events[] = $event; } public static function getEvents() { return self::$events; } /** * @return DateTime */ public function getOccurredOn() { return $this->occurredOn; } } class UserRegisteredEvent extends DomainEvent { private $data; protected function instantiate(...$args) { $this->data = $args; } } class User { /** * @var string */ private $username; /** * User constructor. * * @param string $username */ public function __construct($username) { $this->username = $username; UserRegisteredEvent::trigger($this); } /** * @return string */ public function getUsername() { return $this->username; } } $user = new User('Jimmy K. Oak'); $events = DomainEvent::getEvents(); var_dump($events);

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.0120.00816.75
8.3.50.0110.01121.27
8.3.40.0150.00018.95
8.3.30.0000.01519.00
8.3.20.0090.00020.17
8.3.10.0060.00321.65
8.3.00.0080.00018.05
8.2.180.0150.00318.66
8.2.170.0170.00322.96
8.2.160.0030.01220.44
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00817.75
8.2.110.0030.00622.11
8.2.100.0090.00317.97
8.2.90.0040.00419.20
8.2.80.0050.00317.97
8.2.70.0040.00417.75
8.2.60.0000.00818.16
8.2.50.0030.00518.07
8.2.40.0080.00021.00
8.2.30.0000.00720.70
8.2.20.0000.00817.89
8.2.10.0070.00018.16
8.2.00.0040.00417.99
8.1.280.0070.00725.92
8.1.270.0030.00623.84
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0000.00921.49
8.1.230.0080.00317.71
8.1.220.0040.00417.78
8.1.210.0000.00818.77
8.1.200.0070.00317.61
8.1.190.0080.00017.47
8.1.180.0090.00018.10
8.1.170.0040.00418.70
8.1.160.0030.00521.88
8.1.150.0040.00418.82
8.1.140.0080.00019.63
8.1.130.0080.00017.60
8.1.120.0070.00017.61
8.1.110.0070.00017.59
8.1.100.0040.00417.58
8.1.90.0040.00417.61
8.1.80.0030.00617.65
8.1.70.0000.00717.60
8.1.60.0040.00417.72
8.1.50.0040.00417.64
8.1.40.0090.00317.70
8.1.30.0090.00017.81
8.1.20.0050.00517.77
8.1.10.0040.00417.61
8.1.00.0000.00817.57
8.0.300.0060.00318.77
8.0.290.0050.00216.88
8.0.280.0080.00018.51
8.0.270.0030.00317.27
8.0.260.0030.00318.46
8.0.250.0040.00417.09
8.0.240.0070.00017.15
8.0.230.0080.00017.12
8.0.220.0000.00716.93
8.0.210.0030.00316.93
8.0.200.0030.00317.13
8.0.190.0040.00417.04
8.0.180.0040.00417.08
8.0.170.0030.00417.08
8.0.160.0050.00317.13
8.0.150.0000.00717.02
8.0.140.0080.00017.04
8.0.130.0000.00513.44
8.0.120.0040.00416.93
8.0.110.0000.00716.95
8.0.100.0070.00016.95
8.0.90.0030.00316.84
8.0.80.0120.00317.04
8.0.70.0040.00417.04
8.0.60.0040.00417.14
8.0.50.0070.00016.95
8.0.30.0090.01017.05
8.0.20.0100.01017.40
8.0.10.0040.00416.98
8.0.00.0100.01116.95
7.4.330.0000.00515.08
7.4.320.0030.00316.59
7.4.300.0030.00316.66
7.4.290.0050.00516.73
7.4.280.0060.00316.65
7.4.270.0030.00616.76
7.4.260.0000.00716.54
7.4.250.0040.00416.52
7.4.240.0040.00416.73
7.4.230.0030.00316.83
7.4.220.0150.00716.68
7.4.210.0100.01016.71
7.4.200.0000.00716.63
7.4.160.0060.00916.64
7.4.150.0090.00917.40
7.4.140.0120.01017.86
7.4.130.0130.01016.76
7.4.120.0080.01016.75
7.4.110.0030.01616.76
7.4.100.0110.00716.61
7.4.90.0090.00916.59
7.4.80.0070.01119.39
7.4.70.0110.00616.71
7.4.60.0100.01016.64
7.4.50.0030.00316.56
7.4.40.0140.00316.86
7.4.30.0150.00716.59
7.4.00.0100.00915.20
7.3.330.0000.00613.37
7.3.320.0000.00513.45
7.3.310.0000.00716.47
7.3.300.0030.00316.45
7.3.290.0090.00816.44
7.3.280.0120.00916.44
7.3.270.0070.01117.40
7.3.260.0140.01116.41
7.3.240.0170.00716.60
7.3.230.0060.01216.60
7.3.210.0060.01016.58
7.3.200.0140.00716.66
7.3.190.0160.00016.68
7.3.180.0030.01316.57
7.3.170.0030.01716.74
7.3.160.0090.01316.75
7.3.120.0110.00714.89
7.3.110.0070.01015.12
7.3.100.0070.00714.97
7.3.90.0030.01015.11
7.3.80.0060.00914.88
7.3.70.0040.01214.75
7.3.60.0060.00914.99
7.3.50.0110.00415.13
7.3.40.0000.01215.14
7.3.30.0060.00914.99
7.3.20.0100.00316.80
7.3.10.0070.01016.80
7.3.00.0000.01516.64
7.2.330.0040.01516.55
7.2.320.0070.01116.55
7.2.310.0040.01816.89
7.2.300.0030.01316.93
7.2.290.0190.00316.64
7.2.250.0000.01215.50
7.2.240.0060.01515.18
7.2.230.0120.00315.48
7.2.220.0070.01015.35
7.2.210.0140.00314.81
7.2.200.0100.00715.26
7.2.190.0030.01015.15
7.2.180.0070.00715.10
7.2.170.0030.01315.29
7.2.60.0040.01117.06
7.2.00.0060.01319.57
7.1.330.0100.00615.95
7.1.320.0090.00615.77
7.1.310.0000.01516.11
7.1.300.0000.01415.92
7.1.290.0030.01016.14
7.1.280.0060.00915.87
7.1.270.0060.00915.70
7.1.260.0080.00415.66
7.1.200.0040.00916.03
7.1.100.0070.00718.30
7.1.70.0000.01317.01
7.1.60.0150.01119.50
7.1.50.0060.00917.12
7.1.00.0070.07322.57
7.0.200.0030.00516.88
7.0.60.0100.06320.08
7.0.50.0030.08717.87
7.0.40.0030.09320.15
7.0.30.0300.06320.23
7.0.20.0200.05720.09
7.0.10.0170.07020.25
7.0.00.0100.03720.07
5.6.280.0030.03321.06
5.6.210.0170.07020.53
5.6.200.0130.04018.14
5.6.190.0070.04720.39
5.6.180.0330.08020.64
5.6.170.0230.06320.51
5.6.160.0130.05320.57
5.6.150.0030.04018.16
5.6.140.0100.08018.18
5.6.130.0030.04318.21
5.6.120.0000.04321.03
5.6.110.0070.08721.13
5.6.100.0070.07021.00
5.6.90.0100.07321.12
5.6.80.0100.05320.37
5.5.350.0000.04020.34
5.5.340.0100.06317.99
5.5.330.0100.05020.19
5.5.320.3770.04720.31
5.5.310.0300.05020.34
5.5.300.0030.04017.98
5.5.290.0030.06317.96
5.5.280.0100.05020.88
5.5.270.0130.07320.86
5.5.260.0030.05320.98
5.5.250.0100.07720.47
5.5.240.0100.07020.19
5.4.450.0200.05319.48
5.4.440.0370.07019.34
5.4.430.0070.06319.46
5.4.420.0230.06319.60
5.4.410.0300.05319.34
5.4.400.0270.05318.84
5.4.390.0130.06019.22
5.4.380.0270.04719.26
5.4.370.0200.05019.14
5.4.360.0100.06319.23
5.4.350.0230.04718.98
5.4.340.0300.05319.28
5.4.320.0330.04319.06
5.4.310.0270.04319.28
5.4.300.0300.04019.14
5.4.290.0200.05318.98
5.4.280.0070.06318.87
5.4.270.0270.04318.88
5.4.260.0200.05318.84
5.4.250.0400.05719.14
5.4.240.0130.05319.25
5.4.230.0230.04718.97
5.4.220.0130.05719.14
5.4.210.0170.05019.14
5.4.200.0270.04319.13
5.4.190.0100.05019.05
5.4.180.0200.04318.86
5.4.170.0200.04719.00
5.4.160.0100.05319.23
5.4.150.0200.04719.35
5.4.140.0270.07016.39
5.4.130.0130.05016.50
5.4.120.0170.05016.38
5.4.110.0230.04316.62
5.4.100.0170.05016.29
5.4.90.0170.05716.53
5.4.80.0100.05316.29
5.4.70.0230.03316.57
5.4.60.0030.06016.38
5.4.50.0030.04316.42
5.4.40.0270.03016.42
5.4.30.0270.07016.42
5.4.20.0070.04716.34

preferences:
48.67 ms | 401 KiB | 5 Q