3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CategoryTree { private $categories = []; public function addCategory(string $category, string $parent = null): void { $this->categories[$parent][] = $category; } public function getChildren(string $parent): array { return $this->categories[$parent]; } } $c = new CategoryTree; $c->addCategory('A', null); $c->addCategory('B', 'A'); $c->addCategory('C', 'A'); echo implode(',', $c->getChildren('A')); //Result should be "B,C" or "C,B"

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.70.0110.00416.58
8.3.60.0130.00318.30
8.3.50.0120.00920.20
8.3.40.0110.00423.49
8.3.30.0080.00818.69
8.3.20.0050.00224.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.190.0080.00816.58
8.2.180.0140.00425.92
8.2.170.0090.00919.09
8.2.160.0170.00322.96
8.2.150.0050.00325.66
8.2.140.0080.00024.66
8.2.130.0050.00226.16
8.2.120.0090.00019.58
8.2.110.0110.00021.18
8.2.100.0030.00917.91
8.2.90.0090.00017.50
8.2.80.0080.00018.76
8.2.70.0080.00017.75
8.2.60.0090.00017.80
8.2.50.0030.00517.98
8.2.40.0040.00417.84
8.2.30.0000.00817.75
8.2.20.0000.00720.33
8.2.10.0000.00817.63
8.2.00.0040.00419.23
8.1.280.0110.00725.92
8.1.270.0110.00722.18
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0150.00321.35
8.1.230.0040.00717.76
8.1.220.0080.00017.77
8.1.210.0030.00518.77
8.1.200.0000.00917.35
8.1.190.0000.00817.23
8.1.180.0050.00318.10
8.1.170.0040.00417.62
8.1.160.0080.00018.77
8.1.150.0000.01018.56
8.1.140.0000.00817.38
8.1.130.0040.00417.29
8.1.120.0000.00717.41
8.1.110.0040.00417.36
8.1.100.0080.00017.42
8.1.90.0070.00017.36
8.1.80.0070.00317.39
8.1.70.0000.00717.30
8.1.60.0040.00717.49
8.1.50.0000.00917.44
8.1.40.0080.00317.53
8.1.30.0000.00917.53
8.1.20.0040.00517.58
8.1.10.0040.00517.43
8.1.00.0110.00317.45
8.0.300.0080.00018.81
8.0.290.0040.00416.63
8.0.280.0030.00318.49
8.0.270.0000.00716.81
8.0.260.0070.00016.85
8.0.250.0000.00616.84
8.0.240.0080.00016.91
8.0.230.0000.00716.88
8.0.220.0030.00316.72
8.0.210.0000.00816.73
8.0.200.0030.00316.91
8.0.190.0000.00816.90
8.0.180.0050.00516.78
8.0.170.0040.00416.76
8.0.160.0050.00316.71
8.0.150.0070.00316.73
8.0.140.0040.00516.71
8.0.130.0060.00416.74
8.0.120.0050.00516.79
8.0.110.0100.00116.75
8.0.100.0030.00816.78
8.0.90.0090.00316.77
8.0.80.0070.00516.77
8.0.70.0080.00616.71
8.0.60.0070.00716.72
8.0.50.0070.00616.78
8.0.30.0070.00516.74
8.0.20.0060.00716.85
8.0.10.0070.00616.86
8.0.00.0070.00416.86
7.4.330.0000.00515.55
7.4.320.0000.00616.39
7.4.300.0060.00016.61
7.4.290.0000.00716.34
7.4.280.0030.00516.63
7.4.270.0120.00116.50
7.4.260.0040.00616.41
7.4.250.0090.00616.49
7.4.240.0070.00516.55
7.4.230.0070.00516.49
7.4.220.0100.00116.54
7.4.210.0050.00616.53
7.4.200.0080.00416.47
7.4.190.0070.00516.57
7.4.180.0100.00216.61
7.4.160.0070.00616.47
7.4.150.0090.00216.52
7.4.140.0050.00716.46
7.4.130.0070.00516.38
7.4.120.0080.00316.40
7.4.110.0040.00816.38
7.4.100.0050.00616.46
7.4.90.0090.00216.39
7.4.80.0060.00716.45
7.4.70.0110.00116.43
7.4.60.0060.00616.38
7.4.50.0080.00316.38
7.4.40.0060.00516.35
7.4.30.0070.00416.40
7.4.20.0070.00416.43
7.4.10.0080.00316.41
7.4.00.0070.00516.47
7.3.330.0110.00416.20
7.3.320.0190.00116.33
7.3.310.0170.00316.21
7.3.300.0150.00516.29
7.3.290.0190.00116.26
7.3.280.0140.00616.33
7.3.270.0150.00216.31
7.3.260.0140.00316.37
7.3.250.0130.00516.36
7.3.240.0170.00416.32
7.3.230.0150.00316.33
7.3.220.0140.00216.19
7.3.210.0100.00616.19
7.3.200.0140.00216.06
7.3.190.0130.00416.15
7.3.180.0110.00516.15
7.3.170.0140.00216.16
7.3.160.0090.00816.17
7.3.150.0130.00416.19
7.3.140.0150.00416.25
7.3.130.0130.00416.23
7.3.100.0080.00216.16
7.1.320.0100.00517.45
7.0.20.0120.00216.98
7.0.00.0100.00416.99

preferences:
19.84 ms | 401 KiB | 5 Q