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 { public const STATUS_ACTIVE = 'is_active'; public const STATUS_INACTIVE = 'is_inactive'; // 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; } // ... } $admin = new Admin('michel@petrucciani.com'); var_dump($admin); $admin->setStatus(Admin::STATUS_INACTIVE);

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.0110.00716.75
8.3.50.0170.00016.48
8.3.40.0140.00520.05
8.3.30.0110.00720.97
8.3.20.0080.00723.80
8.3.10.0090.00523.91
8.3.00.0090.00523.26
8.2.180.0070.01425.92
8.2.170.0070.01418.89
8.2.160.0090.01122.96
8.2.150.0070.00823.08
8.2.140.0090.00523.19
8.2.130.0090.00623.79
8.2.120.0070.01121.29
8.2.110.0100.00621.46
8.2.100.0120.00919.78
8.2.90.0180.00518.67
8.2.80.0190.00618.72
8.2.70.0190.00330.69
8.2.60.0150.00718.49
8.2.50.0130.00518.56
8.2.40.0170.00418.88
8.2.30.0160.00518.55
8.2.20.0120.00518.60
8.2.10.0120.00618.36
8.2.00.0120.00518.59
8.1.270.0080.00523.59
8.1.260.0060.00824.33
8.1.250.0080.00524.96
8.1.240.0050.01120.81
8.1.230.0090.00620.36
8.1.220.0190.00418.52
8.1.210.0150.00718.44
8.1.200.0160.00618.32
8.1.190.0140.00718.23
8.1.180.0160.00718.13
8.1.170.0160.00618.32
8.1.160.0150.00618.49
8.1.150.0140.00618.21
8.1.140.0160.00418.17
8.1.130.0130.00618.51
8.1.120.0100.00618.61
8.1.110.0110.00718.17
8.1.100.0110.00618.18
8.1.90.0120.00518.24
8.1.80.0110.00518.20
8.1.70.0100.00618.02
8.1.60.0120.00618.14
8.1.50.0130.00517.97
8.1.40.0130.00517.94
8.1.30.0130.00518.07
8.1.20.0120.00618.09
8.1.10.0110.00617.90
8.1.00.0110.00617.88
8.0.300.0160.00618.51
8.0.290.0210.00317.77
8.0.280.0160.00617.80
8.0.270.0150.00517.73
8.0.260.0140.00617.64
8.0.250.0130.00517.76
8.0.240.0160.00417.62
8.0.230.0130.00617.65
8.0.220.0150.00417.62
8.0.210.0150.00417.73
8.0.200.0130.00617.59
8.0.190.0140.00517.64
8.0.180.0140.00517.51
8.0.170.0140.00417.45
8.0.160.0130.00517.45
8.0.150.0140.00417.30
8.0.140.0130.00517.31
8.0.130.0130.00617.14
8.0.120.0140.00517.01
8.0.110.0110.00617.08
8.0.100.0120.00617.02
8.0.90.0130.00517.01
8.0.80.0130.00516.98
8.0.70.0120.00517.08
8.0.60.0120.00516.99
8.0.50.0140.00516.99
8.0.30.0120.00517.04
8.0.20.0110.00617.11
8.0.10.0120.00617.11
8.0.00.0110.00517.23
7.4.330.0130.00316.65
7.4.320.0150.00617.19
7.4.300.0140.00617.10
7.4.290.0120.00717.06
7.4.280.0150.00416.89
7.4.270.0160.00416.88
7.4.260.0150.00416.81
7.4.250.0140.00516.57
7.4.240.0150.00516.59
7.4.230.0160.00416.57
7.4.220.0130.00516.58
7.4.210.0130.00516.55
7.4.200.0140.00416.56
7.4.190.0130.00616.61
7.4.180.0130.00516.57
7.4.160.0140.00416.63
7.4.150.0130.00616.52
7.4.140.0130.00416.48
7.4.130.0130.00416.46
7.4.120.0140.00516.44
7.4.110.0140.00416.43
7.4.100.0140.00416.53
7.4.90.0130.00516.46
7.4.80.0130.00416.47
7.4.70.0140.00316.44
7.4.60.0140.00416.46
7.4.50.0140.00416.41
7.4.40.0130.00416.40
7.4.30.0120.00516.43
7.4.20.0120.00516.46
7.4.10.0130.00416.44
7.4.00.0120.00516.47
7.3.330.0160.00416.71
7.3.320.0150.00416.43
7.3.310.0140.00516.42
7.3.300.0160.00316.48
7.3.290.0150.00416.43
7.3.280.0150.00316.42
7.3.270.0140.00416.43
7.3.260.0140.00516.42
7.3.250.0140.00616.42
7.3.240.0130.00516.43
7.3.230.0140.00516.41
7.3.220.0140.00516.39
7.3.210.0150.00516.39
7.3.200.0150.00516.38
7.3.190.0160.00516.35
7.3.180.0150.00416.37
7.3.170.0140.00516.39
7.3.160.0150.00516.36
7.3.150.0150.00416.38
7.3.140.0140.00616.38
7.3.130.0140.00516.34
7.3.120.0150.00316.38
7.3.110.0150.00416.35
7.3.100.0150.00416.37
7.3.90.0150.00416.55
7.3.80.0150.00516.40
7.3.70.0160.00416.43
7.3.60.0140.00616.45
7.3.50.0160.00416.46
7.3.40.0140.00416.42
7.3.30.0130.00516.46
7.3.20.0150.00617.63
7.3.10.0160.00417.59
7.3.00.0170.00417.60

preferences:
43.81 ms | 400 KiB | 5 Q