3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Employee { protected $salary; public function __construct($salary) { $this->salary = $salary; } public function getSalary() { return $this->salary; } } class Manager extends Employee { protected $bonus; public function __construct($salary, $bonus) { parent::__construct($salary); $this->bonus = $bonus; } public function getSalary() { return $this->salary + $this->bonus; } } function printEmployeeSalary(Employee $employee) { echo "Salary: " . $employee->getSalary() . "\n"; } $employee = new Employee(3000); $manager = new Manager(5000, 2000); printEmployeeSalary($employee); // Ожидается: Salary: 3000 printEmployeeSalary($manager); // Ожидается: Salary: 7000

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.0070.01319.41
8.4.10.0160.00319.13
8.3.150.0040.01117.32
8.3.140.0090.00016.79
8.3.130.0080.00016.80
8.3.120.0170.00316.73
8.3.110.0370.00316.23
8.3.100.0350.00716.29
8.3.90.0410.00616.36
8.3.80.0350.00916.62
8.3.70.0280.00316.30
8.3.60.0270.01516.82
8.3.50.0370.01116.64
8.3.40.0270.00917.39
8.3.30.0240.01017.53
8.3.20.0360.00017.39
8.3.10.0280.01017.46
8.3.00.0100.01617.48
8.2.260.0000.00717.12
8.2.250.0080.00018.28
8.2.240.0250.01116.57
8.2.230.0300.00316.32
8.2.220.0320.00616.51
8.2.210.0290.01116.23
8.2.200.0370.00716.45
8.2.190.0270.01016.48
8.2.180.0250.00816.40
8.2.170.0330.01017.63
8.2.160.0320.01017.43
8.2.150.0340.00717.43
8.2.140.0410.00717.59
8.2.130.0220.00617.56
8.2.120.0150.00517.51
8.2.110.0290.00417.76
8.2.100.0270.00317.39
8.2.90.0400.00017.24
8.2.80.0370.00417.70
8.2.70.0290.00617.19
8.2.60.0360.00717.34
8.2.50.0410.00317.42
8.2.40.0370.00717.20
8.2.30.0420.00817.48
8.2.20.0380.00017.39
8.2.10.0280.00917.35
8.2.00.0350.00417.36
8.1.310.0140.00318.39
8.1.300.0520.00615.91
8.1.290.0310.00916.16
8.1.280.0330.00715.79
8.1.270.0390.00617.29
8.1.260.0350.00717.41
8.1.250.0310.00317.14
8.1.240.0240.01217.17
8.1.230.0210.01217.39
8.1.220.0260.00717.21
8.1.210.0270.00317.16
8.1.200.0300.00717.21
8.1.190.0270.01117.25
8.1.180.0300.00717.29
8.1.170.0270.01017.06
8.1.160.0290.00917.10
8.1.150.0280.01217.33
8.1.140.0360.00316.89
8.1.130.0230.01017.40
8.1.120.0280.00817.26
8.1.110.0320.00617.14
8.1.100.0310.01117.02
8.1.90.0320.01017.31
8.1.80.0280.01117.21
8.1.70.0240.01417.11
8.1.60.0390.01117.31
8.1.50.0360.00817.16
8.1.40.0360.00617.51
8.1.30.0380.00317.11
8.1.20.0300.01517.27
8.1.10.0200.01617.21
8.1.00.0230.01117.13

preferences:
15.58 ms | 403 KiB | 5 Q