3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ValueObject implements JsonSerializable { private $value; public function __construct($value) { $this->value = $value; } public function jsonSerialize() { return $this->value; } public function equals(ValueObject $value) { return $this->value === $value; } } class Age extends ValueObject { public function __construct(int $value) { if ($value > 150) { throw new Exception('Age must be less than 150.'); } parent::__construct($value); } } class Email extends ValueObject { public function __construct(string $value) { $email = filter_var($value, FILTER_VALIDATE_EMAIL); if (false === $email) { throw new Exception('Email is invalid.'); } parent::__construct($email); } } function Emails(Email ...$emails) { class Emails implements JsonSerializable{ private $values; public function __construct($values) { $this->values = $values; } public function jsonSerialize() { return $this->values; } } } function Email(string $email) : Email { return new Email($email); } function Age(int $age) : Age { return new Age($age); } class User implements JsonSerializable { private $email; private $age; public function __construct(Email $email) { $this->email = $email; } public function setAge(Age $age) { $this->age = $age; return $this; } public function jsonSerialize() { return ['email' => $this->email, 'age' => $this->age]; } public function __destruct() { // persist } } // class UpdateUserCommand { // private $userId; // private $email; // private $age; // private $location; // public function __construct(GUID $userId, Email $email, Age $age = null, Point $location = null) { // $this->userId = $userId; // $this->email = $email; // $this->age = $age; // $this->location = $location; // } // public function getUserId() { return $this->userId; } // public function getEmail() { return $this->email; } // public function getAge() { return $this->age; } // public function getLocation() { return $this->location; } // } // class UserService { // private $users; // public function __construct(Users $users) { // $this->users = $users; // } // public function update(UpdateUserCommand $command) { // $user = $this->users[$command->getUserId()]; // $user->setEmail($command->getEmail()); // $user->setAge($command->getAge()); // $user->setPoint($command->getPoint()); // } // } $emails = Emails(Email('opexus@gmail.com'), Email('irma@wiki.ru')); $age = Age(23); $user = $users[GUID('uudf-dfio-dfioj-dfio')]; $user->setEmails($emails); $user->setAge($age); // $point = Point(Lattitude(-20), Longitude(170)); // $lattitude = new Lattitude(-20); // $longitude = new Longitude(170); // $point = new Point($lattitude, $longitude); // $user = new User($email); // $user->setAge($age); echo json_encode(compact('emails', 'age'));

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.0100.00617.25
8.3.50.0190.00318.75
8.3.40.0100.00619.18
8.3.30.0060.00919.34
8.3.20.0040.00420.41
8.3.10.0050.00323.98
8.3.00.0060.00318.38
8.2.180.0180.00518.79
8.2.170.0140.01422.96
8.2.160.0060.00919.61
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0060.00326.16
8.2.120.0090.00018.13
8.2.110.0060.00322.60
8.2.100.0100.00318.28
8.2.90.0070.00319.59
8.2.80.0030.00618.00
8.2.70.0030.00618.23
8.2.60.0030.00618.18
8.2.50.0040.00718.13
8.2.40.0000.00819.84
8.2.30.0000.00820.92
8.2.20.0030.00518.25
8.2.10.0030.00518.54
8.2.00.0030.00618.32
8.1.270.0000.00924.11
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00322.94
8.1.230.0040.00818.16
8.1.220.0080.00018.15
8.1.210.0000.00918.77
8.1.200.0060.00317.98
8.1.190.0060.00317.84
8.1.180.0000.00818.10
8.1.170.0060.00319.00
8.1.160.0000.00822.21
8.1.150.0030.00621.06
8.1.140.0030.00619.87
8.1.130.0040.00417.99
8.1.120.0030.00517.78
8.1.110.0040.00417.71
8.1.100.0040.00417.75
8.1.90.0030.00517.88
8.1.80.0000.00917.85
8.1.70.0020.00517.75
8.1.60.0060.00618.00
8.1.50.0030.00617.86
8.1.40.0000.01317.88
8.1.30.0040.00417.97
8.1.20.0060.00317.98
8.1.10.0040.00417.82
8.1.00.0080.00419.83
8.0.300.0060.00318.77
8.0.290.0060.00317.38
8.0.280.0000.00818.66
8.0.270.0000.00817.43
8.0.260.0030.00317.38
8.0.250.0030.00517.38
8.0.240.0040.00417.43
8.0.230.0030.00317.32
8.0.220.0000.00717.40
8.0.210.0040.00417.27
8.0.200.0000.00717.30
8.0.190.0000.00817.36
8.0.180.0030.00617.31
8.0.170.0040.00417.24
8.0.160.0080.00017.38
8.0.150.0040.00417.30
8.0.140.0040.00417.20
8.0.130.0060.00013.79
8.0.120.0030.00617.32
8.0.110.0060.00317.37
8.0.100.0030.00517.30
8.0.90.0000.00817.37
8.0.80.0030.01417.34
8.0.70.0040.00417.19
8.0.60.0030.00617.24
8.0.50.0080.00017.35
8.0.30.0100.01217.47
8.0.20.0130.00817.50
8.0.10.0040.00417.37
8.0.00.0080.01417.10
7.4.330.0000.00615.21
7.4.320.0000.00717.09
7.4.300.0060.00016.99
7.4.290.0040.00417.02
7.4.280.0030.00917.02
7.4.270.0000.00717.05
7.4.260.0090.00317.05
7.4.250.0000.00816.94
7.4.240.0050.00317.00
7.4.230.0030.00516.90
7.4.220.0140.00917.05
7.4.210.0080.00917.06
7.4.200.0080.00017.09
7.4.160.0030.01417.03
7.4.150.0090.00917.40
7.4.140.0110.00817.86
7.4.130.0130.00817.04
7.4.120.0050.01417.02
7.4.110.0060.01217.01
7.4.100.0100.01017.16
7.4.90.0090.01517.06
7.4.80.0150.00919.39
7.4.70.0000.02017.05
7.4.60.0120.00817.14
7.4.50.0000.00616.93
7.4.40.0080.01216.88
7.4.30.0100.01417.02
7.4.00.0080.00915.46
7.3.330.0060.00013.76
7.3.320.0060.00013.64
7.3.310.0040.00416.92
7.3.300.0050.00216.83
7.3.290.0070.00016.76
7.3.280.0130.00816.82
7.3.270.0100.01017.40
7.3.260.0030.01516.82
7.3.250.0110.00716.86
7.3.240.0090.01416.97
7.3.230.0070.01116.63
7.3.210.0150.00616.93
7.3.200.0100.01317.02
7.3.190.0090.00916.95
7.3.180.0090.00916.78
7.3.170.0070.01116.87
7.3.160.0120.00916.74
7.3.120.0040.01515.20
7.3.110.0150.00315.21
7.3.100.0120.00615.50
7.3.90.0070.00715.09
7.3.80.0030.01315.26
7.3.70.0030.01315.20
7.3.60.0070.00715.25
7.3.50.0100.00015.34
7.3.40.0040.01115.02
7.3.30.0040.00715.30
7.3.20.0080.01116.97
7.3.10.0080.01016.98
7.3.00.0100.00716.91
7.2.330.0140.00816.96
7.2.320.0130.00617.09
7.2.310.0090.00917.07
7.2.300.0080.01116.99
7.2.290.0160.00817.04
7.2.250.0130.00715.59
7.2.240.0100.01015.19
7.2.230.0100.00315.36
7.2.220.0040.01115.61
7.2.210.0040.01415.24
7.2.200.0110.00315.38
7.2.190.0000.01115.37
7.2.180.0000.01615.25
7.2.170.0040.01215.54
7.2.160.0090.00615.55
7.2.150.0030.01317.19
7.2.140.0090.00617.28
7.2.130.0080.01217.18
7.2.120.0140.00616.90
7.2.110.0110.01117.29
7.2.100.0050.01017.21
7.2.90.0050.01117.10
7.2.80.0150.00517.37
7.2.70.0050.01117.22
7.2.60.0040.01017.14
7.2.50.0090.00817.22
7.2.40.0140.00517.29
7.2.30.0050.01317.04
7.2.20.0140.00417.11
7.2.10.0020.01417.34
7.2.00.0070.01018.09
7.1.330.0100.00316.41
7.1.320.0100.00716.17
7.1.310.0000.01016.13
7.1.300.0030.01216.12
7.1.290.0060.00916.11
7.1.280.0030.00616.39
7.1.270.0060.01016.00
7.1.260.0120.00315.84
7.1.250.0110.00516.22
7.1.240.0090.01116.10
7.1.230.0060.01516.10
7.1.220.0120.00516.27
7.1.210.0110.00516.12
7.1.200.0100.00415.98
7.1.190.0090.00516.14
7.1.180.0050.01116.12
7.1.170.0110.00516.23
7.1.160.0070.00916.11
7.1.150.0100.00916.21
7.1.140.0100.00716.10
7.1.130.0100.00716.06
7.1.120.0050.01016.10
7.1.110.0110.00516.01
7.1.100.0060.01016.98
7.1.90.0080.00816.19
7.1.80.0050.01116.04
7.1.70.0120.00516.40
7.1.60.0080.01317.28
7.1.50.0100.01016.64
7.1.40.0080.00616.14
7.1.30.0090.00516.22
7.1.20.0050.01016.03
7.1.10.0100.00816.06
7.1.00.0100.03118.31
7.0.330.0070.01015.58
7.0.320.0090.00815.66
7.0.310.0090.00715.55
7.0.300.0080.00715.78
7.0.290.0050.01415.69
7.0.280.0090.01015.39
7.0.270.0130.00615.75
7.0.260.0050.00815.83
7.0.250.0090.00915.56
7.0.240.0110.00915.67
7.0.230.0080.00815.66
7.0.220.0050.01015.74
7.0.210.0090.00615.71
7.0.200.0050.01015.54
7.0.190.0120.00715.41
7.0.180.0080.00815.83
7.0.170.0090.00915.65
7.0.160.0070.01015.68
7.0.150.0120.01015.61
7.0.140.0060.01015.74
7.0.130.0110.00515.64
7.0.120.0110.00715.61
7.0.110.0070.01015.75
7.0.100.0070.00915.67
7.0.90.0160.02717.18
7.0.80.0040.02617.29
7.0.70.0150.02817.11
7.0.60.0150.02517.23
7.0.50.0080.02717.32
7.0.40.0070.02315.86
7.0.30.0060.03516.01
7.0.20.0050.02615.99
7.0.10.0140.02915.99
7.0.00.0050.02815.92
5.6.400.0070.00714.18
5.6.390.0000.01914.10
5.6.380.0100.00514.31
5.6.370.0030.00814.22
5.6.360.0070.00814.18
5.6.350.0060.00614.01
5.6.340.0070.00713.99
5.6.330.0060.00914.14
5.6.320.0110.00314.01
5.6.310.0000.01614.03
5.6.300.0110.00714.06
5.6.290.0120.00713.90
5.6.280.0030.02116.41
5.6.270.0070.01014.06
5.6.260.0060.00813.89
5.6.250.0040.01214.06
5.6.240.0070.02616.22
5.6.230.0100.03016.28
5.6.220.0080.01916.18
5.6.210.0060.02516.08
5.6.200.0110.02616.38
5.6.190.0050.02616.45
5.6.180.0090.03516.35
5.6.170.0080.03616.52
5.6.160.0060.03516.46
5.6.150.0030.03316.38
5.6.140.0070.03616.42
5.6.130.0050.02616.43
5.6.120.0060.02716.38
5.6.110.0120.03016.29
5.6.100.0060.02116.41
5.6.90.0040.03316.33
5.6.80.0050.03116.21
5.6.70.0080.03116.05
5.6.60.0090.02916.13
5.6.50.0110.02916.11
5.6.40.0120.02816.23
5.6.30.0140.02616.11
5.6.20.0090.02016.11
5.6.10.0090.03016.10
5.6.00.0090.02916.14
5.5.380.0070.02015.00
5.5.370.0070.01815.11
5.5.360.0060.03115.06
5.5.350.0020.02315.00
5.5.340.0070.02615.24
5.5.330.0060.01915.23
5.5.320.0090.02315.35
5.5.310.0070.03015.23
5.5.300.0050.03215.17
5.5.290.0100.02815.13
5.5.280.0050.02215.30
5.5.270.0060.03115.32
5.5.260.0080.02115.25
5.5.250.0060.02915.22
5.5.240.0060.02914.97
5.5.230.0080.01814.95
5.5.220.0050.01814.84
5.5.210.0090.01614.87
5.5.200.0020.02414.86
5.5.190.0020.02514.99
5.5.180.0080.02114.93
5.5.170.0050.00712.31
5.5.160.0100.02814.99
5.5.150.0050.02314.90
5.5.140.0020.03115.07
5.5.130.0080.02414.81
5.5.120.0030.03214.89
5.5.110.0030.03415.03
5.5.100.0060.02115.04
5.5.90.0070.02714.83
5.5.80.0070.01715.05
5.5.70.0080.02814.95
5.5.60.0030.03214.74
5.5.50.0070.02214.59
5.5.40.0070.03014.85
5.5.30.0030.03114.99
5.5.20.0050.02314.85
5.5.10.0040.03314.87
5.5.00.0100.01615.00

preferences:
65.14 ms | 400 KiB | 5 Q