3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(-1); class Company { public $companyName; public $companyDepartments = []; public $companySalary; public function __construct($companyName, $companyDepartments) { $this->companyName = $companyName; $this->companyDepartments = $companyDepartments; } public function createDepartment($departmentName) { return new $departmentName; } /*public function getCompanySalary($departments) { foreach ($departments as $department) { $result += $department->getDepartmentSalary(); } return $result; }*/ } class Department { public $departmentName; public $employees = []; public function __construct($departmentName) { $this->departmentName = $departmentName; } public function setDepartmentEmployees($departmentName, $department) { $this->departmentName = $departmentName; $employees[] = 0; for ($i = 1; $i < count($department) - 1; $i++) { $employees[] = $department[$i][$i - 1]; $department->employees = $employees; } } public function getDepartmentSalary($department) { return $department->getDepartmentSalary(); } } class Profession { public $professionName; public $coffee; public $pages; public $salary; public function __construct($professionName) { $this->professionName = $professionName; } public function setCoffee($boss) { switch($this->professionName){ case 'Man': $this->coffee = 20; break; case 'Mar': $this->coffee = 15; break; case 'Eng': $this->coffee = 5; break; case 'Ana': $this->coffee = 50; break; } if ($boss == true) { return $this->coffee * 2; } else { return $this->coffee; } } public function setPages($boss) { switch($this->professionName){ case 'Man': $this->pages = 200; break; case 'Mar': $this->pages = 150; break; case 'Eng': $this->pages = 50; break; case 'Ana': $this->pages = 5; break; } if ($boss == true) { return $this->pages = 0; } else { return $this->pages; } } public function setSalary($boss) { switch($this->professionName){ case 'Man': $this->salary = 500; break; case 'Mar': $this->salary = 400; break; case 'Eng': $this->salary = 200; break; case 'Ana': $this->salary = 800; break; } if ($boss == true) { return $this->salary * 1.5; } else { return $this->salary; } } } $departments = []; $purchaseDepartment = ['Name' => 'Purchase', 'man1' => 9, 'man2' => 3, 'man3' => 2, 'mar1' => 2, 'boss' => 'man2']; $departments[] = $purchaseDepartment; $saleDepartment = ['Name' => 'Sale', 'man1' => 12, 'mar1' => 6, 'ana1' => 3, 'ana2' => 2, 'boss' => 'mar2']; $departments[] = $saleDepartment; $advertisingDepartment = ['Name' => 'Advertising', 'mar1' => 15, 'mar2' => 10, 'man1' => 8, 'eng1' => 2, 'boss' => 'mar3']; $departments[] = $advertisingDepartment; $logisticsDepartment = ['Name' => 'Logistics', 'man1' => 13, 'man2' => 5, 'eng1' => 5, 'boss' => 'man1']; $departments[] = $logisticsDepartment; function createEmployees($departments) { } $vector = new Company('Vector', $departments); foreach ($departments as $department) { $vector->createDepartment($department['Name']); }

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.140.0140.00817.72
8.4.130.0090.01018.01
8.4.120.0160.00520.47
8.4.110.0050.00922.63
8.4.100.0080.00317.89
8.4.90.0110.01020.41
8.4.80.0060.00420.80
8.4.70.0120.00818.66
8.4.60.0100.01120.66
8.4.50.0130.00620.52
8.4.40.0100.01019.52
8.4.30.0100.01019.59
8.4.20.0030.00618.41
8.4.10.0000.01119.70
8.3.270.0090.01116.80
8.3.260.0100.00416.90
8.3.250.0110.00819.14
8.3.240.0090.01217.11
8.3.230.0090.00716.74
8.3.220.0130.00518.94
8.3.210.0170.00318.54
8.3.200.0050.00416.77
8.3.190.0140.00516.88
8.3.180.0130.00618.74
8.3.170.0150.00317.27
8.3.160.0040.01417.44
8.3.150.0030.00516.87
8.3.140.0110.00716.55
8.3.130.0030.00616.90
8.3.120.0150.00419.03
8.3.110.0000.00920.94
8.3.100.0130.00724.06
8.3.90.0080.00026.77
8.3.80.0090.00018.68
8.3.70.0130.00316.88
8.3.60.0040.01516.88
8.3.50.0050.01221.99
8.3.40.0090.00918.88
8.3.30.0040.01118.78
8.3.20.0040.00420.39
8.3.10.0080.00020.60
8.3.00.0050.00323.53
8.2.290.0040.00520.30
8.2.280.0080.01220.26
8.2.270.0040.01416.98
8.2.260.0110.00717.16
8.2.250.0070.00316.73
8.2.240.0040.00418.96
8.2.230.0090.00022.58
8.2.220.0080.00037.54
8.2.210.0090.00926.77
8.2.200.0070.00316.63
8.2.190.0120.00417.00
8.2.180.0090.00625.92
8.2.170.0180.00022.96
8.2.160.0100.00320.43
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0000.00820.40
8.2.120.0080.00026.16
8.2.110.0000.01122.08
8.2.100.0090.00318.03
8.2.90.0060.00317.88
8.2.80.0060.00319.13
8.2.70.0000.00817.75
8.2.60.0050.00317.75
8.2.50.0070.00717.72
8.2.40.0080.00019.47
8.2.30.0030.00620.35
8.2.20.0000.00818.14
8.2.10.0000.00818.08
8.2.00.0030.00518.30
8.1.330.0090.00721.98
8.1.320.0110.00816.49
8.1.310.0000.00817.03
8.1.300.0080.00318.09
8.1.290.0100.00018.88
8.1.280.0040.01125.92
8.1.270.0080.00620.70
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00422.61
8.1.230.0090.00320.85
8.1.220.0060.00317.74
8.1.210.0060.00318.77
8.1.200.0030.00617.25
8.1.190.0030.00619.31
8.1.180.0060.00318.10
8.1.170.0040.00418.93
8.1.160.0040.00418.86
8.1.150.0030.00520.37
8.1.140.0000.00819.57
8.1.130.0070.00020.81
8.1.120.0050.00217.52
8.1.110.0000.00817.38
8.1.100.0030.00417.36
8.1.90.0050.00217.53
8.1.80.0000.00717.51
8.1.70.0000.00917.45
8.1.60.0000.00917.64
8.1.50.0040.00417.46
8.1.40.0040.00417.59
8.1.30.0040.00417.59
8.1.20.0040.00417.71
8.1.10.0040.00417.57
8.1.00.0040.00417.59
8.0.300.0040.00420.29
8.0.290.0060.00316.75
8.0.280.0070.00018.48
8.0.270.0070.00017.29
8.0.260.0060.00017.25
8.0.250.0030.00317.08
8.0.240.0030.00517.05
8.0.230.0030.00316.96
8.0.220.0050.00216.89
8.0.210.0060.00316.84
8.0.200.0040.00416.92
8.0.190.0030.00617.03
8.0.180.0000.00716.98
8.0.170.0000.00817.05
8.0.160.0040.00416.96
8.0.150.0100.00016.82
8.0.140.0040.00416.94
8.0.130.0070.00013.38
8.0.120.0080.00016.88
8.0.110.0050.00216.77
8.0.100.0030.00616.88
8.0.90.0030.00417.00
8.0.80.0070.01316.94
8.0.70.0080.00016.89
8.0.60.0000.00717.05
8.0.50.0000.00816.85
8.0.30.0110.00617.14
8.0.20.0160.01117.40
8.0.10.0000.00717.11
8.0.00.0110.00616.75
7.4.330.0030.00415.55
7.4.320.0060.00016.56
7.4.300.0000.00616.55
7.4.290.0000.00716.63
7.4.280.0070.00016.64
7.4.270.0000.00716.58
7.4.260.0070.00016.59
7.4.250.0000.00716.62
7.4.240.0080.00016.48
7.4.230.0030.00316.64
7.4.220.0160.00716.57
7.4.210.0070.01116.64
7.4.200.0030.00316.54
7.4.160.0070.01016.53
7.4.150.0170.00017.40
7.4.140.0080.01117.86
7.4.130.0090.00816.54
7.4.120.0090.01216.52
7.4.110.0120.00616.44
7.4.100.0150.00316.39
7.4.90.0100.00716.57
7.4.80.0160.00319.39
7.4.70.0110.00716.38
7.4.60.0040.01216.53
7.4.50.0000.01316.37
7.4.40.0120.00616.42
7.4.30.0070.01016.62
7.4.10.0130.00614.56
7.4.00.0060.01215.21
7.3.330.0050.00013.44
7.3.320.0030.00313.44
7.3.310.0030.00516.49
7.3.300.0040.00416.47
7.3.290.0070.00716.43
7.3.280.0100.00916.44
7.3.270.0150.00417.40
7.3.260.0060.01116.59
7.3.250.0110.00916.47
7.3.240.0130.00616.62
7.3.230.0100.01116.39
7.3.210.0120.00616.71
7.3.200.0120.00916.48
7.3.190.0070.00916.66
7.3.180.0130.00316.55
7.3.170.0180.00416.58
7.3.160.0100.00716.64
7.3.130.0030.01615.02
7.3.120.0110.00514.98
7.3.110.0050.01214.81
7.3.100.0030.01214.90
7.3.90.0120.00414.83
7.3.80.0030.00714.81
7.3.70.0070.00314.87
7.3.60.0080.00614.86
7.3.50.0080.00614.93
7.3.40.0080.00514.90
7.3.30.0030.01114.99
7.3.20.0080.00516.67
7.3.10.0060.00716.66
7.3.00.0060.00716.70
7.2.330.0140.00316.55
7.2.320.0060.01216.64
7.2.310.0090.00816.76
7.2.300.0070.01116.54
7.2.290.0000.01616.57
7.2.260.0070.01115.18
7.2.250.0070.01015.20
7.2.240.0150.00215.02
7.2.230.0070.00615.12
7.2.220.0080.00615.17
7.2.210.0090.00315.21
7.2.200.0050.01015.09
7.2.190.0030.01215.04
7.2.180.0030.01215.16
7.2.170.0050.01015.09
7.2.160.0140.00315.04
7.2.150.0000.01116.71
7.2.140.0030.01216.96
7.2.130.0040.00816.97
7.2.120.0050.00716.93
7.2.110.0030.00816.75
7.2.100.0040.00816.69
7.2.90.0090.00516.84
7.2.80.0060.01017.00
7.2.70.0030.01116.82
7.2.60.0070.00716.90
7.2.50.0050.00817.02
7.2.40.0070.00716.84
7.2.30.0060.00916.96
7.2.20.0080.00816.99
7.2.10.0060.00716.85
7.2.00.0060.00717.65
7.1.330.0000.01615.88
7.1.320.0080.00615.96
7.1.310.0040.00915.88
7.1.300.0050.00615.62
7.1.290.0070.00715.82
7.1.280.0060.00615.73
7.1.270.0080.00515.79
7.1.260.0030.01015.95
7.1.250.0040.00815.85
7.1.240.0000.00915.97
7.1.230.0040.00715.61
7.1.220.0080.00615.96
7.1.210.0030.01015.78
7.1.200.0060.00915.63
7.1.190.0030.01015.71
7.1.180.0060.00615.96
7.1.170.0030.01015.63
7.1.160.0060.00915.77
7.1.150.0100.00315.98
7.1.140.0030.00915.98
7.1.130.0090.00615.72
7.1.120.0070.00715.93
7.1.110.0030.00615.67
7.1.100.0060.00617.16
7.1.90.0060.00916.00
7.1.80.0060.00315.67
7.1.70.0030.00716.70
7.1.60.0030.01016.52
7.1.50.0050.01316.49
7.1.40.0040.00815.55
7.1.30.0120.03727.04
7.1.20.0150.04127.05
7.1.10.0630.03318.03
7.1.00.0650.03618.23
7.0.330.0000.00915.39
7.0.320.0040.00415.35
7.0.310.0070.01015.28
7.0.300.0070.00715.23
7.0.290.0070.00715.58
7.0.280.0040.00715.54
7.0.270.0130.00015.28
7.0.260.0000.01315.46
7.0.250.0110.00415.33
7.0.240.0030.00915.14
7.0.230.0120.00315.48
7.0.220.0060.00815.54
7.0.210.0070.01015.40
7.0.200.0060.00915.96
7.0.190.0110.00315.50
7.0.180.0030.01315.39
7.0.170.0050.04518.57
7.0.160.0320.03717.80
7.0.150.0880.03317.71
7.0.140.0460.03217.72
7.0.130.0810.03917.67
7.0.120.0450.04917.68
7.0.110.0400.03817.81
7.0.100.0440.03517.68
7.0.90.0700.05617.86
7.0.80.0460.03217.68
7.0.70.0430.03317.67
7.0.60.0370.04017.70
7.0.50.0810.03317.89
7.0.40.0700.02816.69
7.0.30.0720.03516.72
7.0.20.0830.04216.67
7.0.10.0620.03316.78
7.0.00.0720.04116.69
5.6.400.0030.00714.46
5.6.390.0030.00514.41
5.6.380.0030.00714.79
5.6.370.0060.01214.52
5.6.360.0070.01014.52
5.6.350.0090.00614.65
5.6.340.0070.00714.12
5.6.330.0070.00314.63
5.6.320.0090.00614.72
5.6.310.0030.01614.35
5.6.300.0110.00314.64
5.6.290.0060.00614.75
5.6.280.0070.00714.83
5.6.270.0100.00314.54
5.6.260.0040.01114.38
5.6.250.0040.00814.66
5.6.240.0000.00914.59
5.6.230.0080.00614.41
5.6.220.0090.00614.58
5.6.210.0000.01414.38
5.6.200.0030.01014.41
5.6.190.0090.00614.82
5.6.180.0070.00414.53
5.6.170.0000.01414.54
5.6.160.0060.00914.51
5.6.150.0000.01414.39
5.6.140.0110.00314.59
5.6.130.0030.00914.52
5.6.120.0070.00714.66
5.6.110.0070.01014.63
5.6.100.0110.00314.52
5.6.90.0140.00314.42
5.6.80.0070.01014.63
5.6.70.0060.00914.11
5.6.60.0060.00614.25
5.6.50.0070.00714.32
5.6.40.0100.00314.37
5.6.30.0040.01414.62
5.6.20.0040.01214.70
5.6.10.0030.01214.15
5.6.00.0120.00314.38

preferences:
31.7 ms | 403 KiB | 5 Q