3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); abstract class User { public const STATUS_ACTIVE = 'active'; public const STATUS_INACTIVE = 'inactive'; public function __construct(public string $email, public string $status = self::STATUS_ACTIVE) { } public function setStatus(string $status): void { assert( in_array($status, [self::STATUS_ACTIVE, self::STATUS_INACTIVE]), sprintf('Le status %s n\'est pas valide. Les status possibles sont : %s', $status, implode(', ',[self::STATUS_ACTIVE, self::STATUS_INACTIVE])) ); $this->status = $status; } public function getStatus(): string { return $this->status; } abstract public function getUsername(): string; } final class Admin extends User { // Ajout d'un tableau de roles pour affiner les droits des administrateurs :) public function __construct(string $email, string $status = self::STATUS_ACTIVE, public array $roles = []) { parent::__construct($email, $status); } public function getUsername(): string { return $this->email; } // ... } // Ceci est impossible maintenant que la classe Admin est marquée comme finale. // class SuperAdmin extends Admin {} $admin = new Admin('trompete@guy.com', 'Ibrahim Maalouf'); var_dump($admin);

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.40.0110.00418.70
8.3.30.0180.00318.71
8.3.20.0100.00522.89
8.3.10.0160.00423.26
8.3.00.0050.00724.42
8.2.170.0110.00718.79
8.2.160.0160.00022.96
8.2.150.0120.00222.34
8.2.140.0090.00622.60
8.2.130.0050.00723.36
8.2.120.0150.00019.79
8.2.110.0090.00319.79
8.2.100.0110.00518.37
8.2.90.0020.01318.30
8.2.80.0070.00718.63
8.2.70.0050.00818.20
8.2.60.0060.00718.35
8.2.50.0070.00418.21
8.2.40.0070.00719.86
8.2.30.0040.00918.90
8.2.20.0060.00818.40
8.2.10.0050.00618.23
8.2.00.0070.00618.48
8.1.270.0060.00723.06
8.1.260.0100.00424.22
8.1.250.0060.00525.17
8.1.240.0120.00221.08
8.1.230.0110.00519.72
8.1.220.0050.01018.22
8.1.210.0080.00518.58
8.1.200.0110.00318.05
8.1.190.0070.00417.96
8.1.180.0060.00618.21
8.1.170.0080.00318.63
8.1.160.0040.00719.52
8.1.150.0090.00218.82
8.1.140.0050.00618.22
8.1.130.0070.00517.76
8.1.120.0090.00417.75
8.1.110.0090.00417.62
8.1.100.0070.00417.73
8.1.90.0090.00217.55
8.1.80.0070.00617.91
8.1.70.0090.00517.53
8.1.60.0080.00517.81
8.1.50.0080.00717.72
8.1.40.0100.00517.62
8.1.30.0100.00717.77
8.1.20.0150.00417.96
8.1.10.0100.00617.63
8.1.00.0090.00817.54
8.0.300.0040.00818.89
8.0.290.0160.00517.25
8.0.280.0170.00318.08
8.0.270.0050.00717.16
8.0.260.0080.00717.13
8.0.250.0090.00517.18
8.0.240.0140.00417.16
8.0.230.0100.00617.13
8.0.220.0080.00717.05
8.0.210.0110.00717.05
8.0.200.0070.00717.03
8.0.190.0130.00517.01
8.0.180.0120.00416.97
8.0.170.0110.00616.92
8.0.160.0110.00516.92
8.0.150.0090.00716.86
8.0.140.0100.00616.83
8.0.130.0090.00616.45
8.0.120.0100.00516.90
8.0.110.0070.00616.94
8.0.100.0080.00716.89
8.0.90.0090.00616.87
8.0.80.0080.00516.88
8.0.70.0070.00616.90
8.0.60.0110.00316.89
8.0.50.0100.00516.88
8.0.30.0070.00616.88
8.0.20.0070.00716.94
8.0.10.0090.00516.99
8.0.00.0070.00617.26
7.4.330.0130.00115.48
7.4.320.0100.00316.61
7.4.300.0090.00616.52
7.4.290.0110.00516.50
7.4.280.0130.00516.48
7.4.270.0100.00516.47
7.4.260.0120.00416.05
7.4.250.0110.00516.44
7.4.240.0100.00416.43
7.4.230.0100.00416.44
7.4.220.0110.00316.45
7.4.210.0090.00416.47
7.4.200.0120.00416.47
7.4.190.0110.00316.46
7.4.180.0090.00616.53
7.4.160.0100.00416.50
7.4.150.0110.00416.38
7.4.140.0100.00416.36
7.4.130.0090.00516.31
7.4.120.0110.00316.32
7.4.110.0110.00316.31
7.4.100.0100.00416.38
7.4.90.0090.00516.29
7.4.80.0100.00416.37
7.4.70.0100.00616.29
7.4.60.0090.00616.31
7.4.50.0100.00516.21
7.4.40.0080.00716.25
7.4.30.0080.00716.37
7.4.20.0070.00616.28
7.4.10.0090.00516.28
7.4.00.0080.00516.29
7.3.330.0140.00416.30
7.3.320.0140.00415.91
7.3.310.0130.00416.20
7.3.300.0110.00516.34
7.3.290.0130.00516.23
7.3.280.0130.00416.25
7.3.270.0140.00416.14
7.3.260.0120.00516.26
7.3.250.0120.00516.26
7.3.240.0110.00716.26
7.3.230.0120.00416.18
7.3.220.0110.00516.15
7.3.210.0130.00416.23
7.3.200.0120.00516.15
7.3.190.0120.00516.11
7.3.180.0120.00616.19
7.3.170.0120.00516.23
7.3.160.0120.00516.21
7.3.150.0130.00316.14
7.3.140.0100.00716.20
7.3.130.0120.00516.25
7.3.120.0110.00516.13
7.3.110.0120.00516.16
7.3.100.0110.00516.10
7.3.90.0130.00516.43
7.3.80.0110.00516.23
7.3.70.0110.00416.25
7.3.60.0100.00516.24
7.3.50.0120.00316.28
7.3.40.0100.00516.29
7.3.30.0110.00516.31
7.3.20.0130.00417.19
7.3.10.0120.00517.19
7.3.00.0160.00417.11

preferences:
57.16 ms | 400 KiB | 5 Q