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.4.20.0040.00418.87
8.4.10.0030.00617.51
8.3.150.0070.01117.38
8.3.140.0080.00016.61
8.3.130.0210.00616.62
8.3.120.0170.01218.56
8.3.110.0210.01017.95
8.3.100.0200.00925.01
8.3.90.0250.00919.83
8.3.80.0290.00616.53
8.3.70.0310.00816.46
8.3.60.0290.00717.13
8.3.50.0290.00816.41
8.3.40.0220.00617.85
8.3.30.0210.00917.79
8.3.20.0210.00720.16
8.3.10.0250.00620.25
8.3.00.0110.00722.10
8.2.260.0110.00716.54
8.2.250.0110.01116.70
8.2.240.0130.00916.68
8.2.230.0210.00718.41
8.2.220.0200.00819.02
8.2.210.0180.00619.93
8.2.200.0170.00616.73
8.2.190.0250.00416.53
8.2.180.0120.00919.62
8.2.170.0140.00718.07
8.2.160.0310.00119.18
8.2.150.0240.00519.87
8.2.140.0190.00920.02
8.2.130.0200.00620.39
8.2.120.0250.00218.65
8.2.110.0200.00718.65
8.2.100.0200.00817.86
8.2.90.0160.00817.87
8.2.80.0210.00818.06
8.2.70.0220.00917.73
8.2.60.0180.00617.82
8.2.50.0140.00417.90
8.2.40.0170.00818.63
8.2.30.0110.00918.37
8.2.20.0150.00817.81
8.2.10.0090.00618.04
8.2.00.0090.00618.18
8.1.310.0110.00416.90
8.1.300.0110.00716.40
8.1.290.0190.01020.92
8.1.280.0200.00619.28
8.1.270.0160.01020.10
8.1.260.0220.00420.77
8.1.250.0210.00521.21
8.1.240.0230.00419.10
8.1.230.0220.00518.46
8.1.220.0180.00817.58
8.1.210.0160.00917.83
8.1.200.0170.00717.62
8.1.190.0150.00617.49
8.1.180.0160.00717.61
8.1.170.0190.00517.84
8.1.160.0190.00718.31
8.1.150.0250.00317.87
8.1.140.0160.00517.77
8.1.130.0160.00717.56
8.1.120.0150.00517.48
8.1.110.0130.00517.50
8.1.100.0130.00417.53
8.1.90.0130.00317.44
8.1.80.0130.00617.64
8.1.70.0130.00617.44
8.1.60.0150.00517.66
8.1.50.0150.00617.62
8.1.40.0140.00517.57
8.1.30.0150.00717.69
8.1.20.0180.00517.78
8.1.10.0150.00717.58
8.1.00.0120.00817.47
8.0.300.0180.00717.69
8.0.290.0220.00716.90
8.0.280.0260.00317.18
8.0.270.0170.00716.83
8.0.260.0160.00716.87
8.0.250.0200.00516.89
8.0.240.0200.00616.91
8.0.230.0170.00716.90
8.0.220.0150.00716.86
8.0.210.0160.00816.87
8.0.200.0130.00816.85
8.0.190.0170.00616.87
8.0.180.0160.00616.83
8.0.170.0160.00616.81
8.0.160.0150.00516.83
8.0.150.0140.00716.74
8.0.140.0140.00616.73
8.0.130.0130.00716.45
8.0.120.0150.00516.80
8.0.110.0120.00616.84
8.0.100.0120.00716.80
8.0.90.0120.00516.79
8.0.80.0120.00616.80
8.0.70.0120.00616.83
8.0.60.0140.00416.78
8.0.50.0140.00416.77
8.0.30.0100.00716.81
8.0.20.0100.00616.88
8.0.10.0110.00516.93
8.0.00.0100.00617.13
7.4.330.0210.00215.73
7.4.320.0150.00516.46
7.4.300.0140.00716.39
7.4.290.0150.00516.41
7.4.280.0170.00516.39
7.4.270.0130.00516.41
7.4.260.0140.00516.07
7.4.250.0120.00616.38
7.4.240.0130.00516.37
7.4.230.0120.00516.39
7.4.220.0120.00416.39
7.4.210.0110.00416.39
7.4.200.0130.00416.41
7.4.190.0150.00416.38
7.4.180.0120.00616.49
7.4.160.0130.00516.44
7.4.150.0140.00416.34
7.4.140.0120.00416.31
7.4.130.0110.00516.27
7.4.120.0120.00316.28
7.4.110.0130.00316.24
7.4.100.0110.00416.33
7.4.90.0100.00516.26
7.4.80.0120.00516.33
7.4.70.0130.00516.26
7.4.60.0130.00516.25
7.4.50.0130.00516.17
7.4.40.0110.00716.21
7.4.30.0110.00616.32
7.4.20.0110.00616.24
7.4.10.0110.00616.24
7.4.00.0120.00516.24
7.3.330.0180.00416.25
7.3.320.0160.00515.91
7.3.310.0140.00616.17
7.3.300.0140.00616.26
7.3.290.0150.00516.19
7.3.280.0160.00516.21
7.3.270.0160.00416.13
7.3.260.0140.00516.24
7.3.250.0140.00516.22
7.3.240.0130.00616.22
7.3.230.0150.00416.15
7.3.220.0140.00616.12
7.3.210.0150.00516.20
7.3.200.0150.00516.12
7.3.190.0140.00516.10
7.3.180.0150.00616.15
7.3.170.0130.00516.19
7.3.160.0130.00516.15
7.3.150.0160.00316.11
7.3.140.0140.00616.14
7.3.130.0150.00516.21
7.3.120.0150.00516.11
7.3.110.0140.00516.13
7.3.100.0140.00516.07
7.3.90.0150.00516.37
7.3.80.0140.00516.18
7.3.70.0130.00416.18
7.3.60.0120.00516.22
7.3.50.0130.00416.26
7.3.40.0120.00516.23
7.3.30.0120.00516.29
7.3.20.0150.00417.09
7.3.10.0140.00517.15
7.3.00.0170.00417.05

preferences:
34.14 ms | 403 KiB | 5 Q