3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [ (object)['level' => '1', 'title' => 'Home'], (object)['level' => '1', 'title' => 'DIFC'], (object)['level' => '1', 'title' => 'ADGM'], (object)['level' => '1', 'title' => 'About'], (object)['level' => '1', 'title' => 'Publications'], (object)['level' => '2', 'title' => 'FinTech: Now Everybody Wants A Slice of the Pie'], (object)['level' => '2', 'title' => 'The Role of Financial Centres in Emerging Economies'], (object)['level' => '2', 'title' => 'Bitcoin versus Ethereum '], (object)['level' => '1', 'title' => 'ADGM'], (object)['level' => '1', 'title' => 'DIFC'], (object)['level' => '1', 'title' => 'Finance'], (object)['level' => '1', 'title' => 'Contact'] ]; echo '<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">' . "\n"; foreach ($items as $i => $menu_item) { if($menu_item->level == '1') { if ($i) { // so long as not the first row of results if ($sub_menu) { // only display a batch of submenus if batch is not empty echo "\n\t\t<ul>\n\t\t\t<li>" . implode("</li>\n\t\t\t<li>", $sub_menu) . "</li>\n\t\t</ul>"; } echo "\n\t" . '</li>' . "\n"; } $sub_menu = array(); // start over with a new batch echo "\t" . '<li itemprop="name">' . "\n"; echo "\t\t" . '<a itemprop="url" href="http://www.10leaves.ae/">' . $menu_item->title . '</a>'; } elseif ($menu_item->level == '2') { $sub_menu[] = $menu_item->title; } } if ($items) { echo "\n\t</li>"; } echo "\n</ul>";

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.0140.00418.55
8.3.50.0070.01116.72
8.3.40.0180.00018.96
8.3.30.0040.01118.75
8.3.20.0080.00019.14
8.3.10.0000.00923.64
8.3.00.0000.00823.66
8.2.180.0090.00616.50
8.2.170.0040.01122.96
8.2.160.0150.00318.96
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0000.00720.56
8.2.120.0060.00326.35
8.2.110.0100.00022.12
8.2.100.0080.00418.03
8.2.90.0030.00617.75
8.2.80.0000.00817.97
8.2.70.0000.00817.93
8.2.60.0000.00818.05
8.2.50.0000.00818.10
8.2.40.0060.00319.31
8.2.30.0000.00919.16
8.2.20.0040.00718.05
8.2.10.0070.00019.34
8.2.00.0030.00619.45
8.1.280.0110.00725.92
8.1.270.0040.00421.98
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00622.55
8.1.230.0070.00421.02
8.1.220.0090.00018.77
8.1.210.0050.00319.06
8.1.200.0070.00317.35
8.1.190.0090.00017.23
8.1.180.0000.00818.10
8.1.170.0000.00818.80
8.1.160.0060.00318.90
8.1.150.0000.00718.91
8.1.140.0040.00419.61
8.1.130.0000.00818.95
8.1.120.0080.00417.46
8.1.110.0000.00717.54
8.1.100.0070.00017.45
8.1.90.0070.00017.37
8.1.80.0000.00717.52
8.1.70.0040.00417.36
8.1.60.0030.00617.49
8.1.50.0030.00617.54
8.1.40.0030.00517.43
8.1.30.0050.00317.67
8.1.20.0030.00617.67
8.1.10.0040.00417.58
8.1.00.0000.00817.52
8.0.300.0090.00019.98
8.0.290.0000.00716.75
8.0.280.0060.00318.48
8.0.270.0030.00317.29
8.0.260.0030.00317.20
8.0.250.0030.00317.04
8.0.240.0000.00717.02
8.0.230.0000.00716.96
8.0.220.0040.00416.98
8.0.210.0030.00316.95
8.0.200.0000.00717.04
8.0.190.0000.00716.95
8.0.180.0050.00317.02
8.0.170.0060.00317.05
8.0.160.0030.00516.94
8.0.150.0000.00716.90
8.0.140.0040.00416.94
8.0.130.0060.00013.38
8.0.120.0000.00816.88
8.0.110.0050.00216.86
8.0.100.0040.00416.81
8.0.90.0070.00016.87
8.0.80.0100.01216.93
8.0.70.0000.00716.96
8.0.60.0050.00316.89
8.0.50.0000.00816.86
8.0.30.0110.00817.15
8.0.20.0130.00717.40
8.0.10.0040.00416.99
8.0.00.0130.00716.74
7.4.330.0000.00515.55
7.4.320.0030.00316.57
7.4.300.0030.00316.54
7.4.290.0100.00016.62
7.4.280.0030.00516.61
7.4.270.0060.00316.68
7.4.260.0040.00416.61
7.4.250.0050.00216.65
7.4.240.0040.00416.64
7.4.230.0040.00416.42
7.4.220.0050.00316.64
7.4.210.0070.01116.59
7.4.200.0050.00216.60
7.4.140.0090.01117.86
7.4.130.0040.01416.66
7.4.120.0110.00816.52
7.4.110.0090.00916.52
7.4.100.0060.01216.61
7.4.90.0060.01616.36
7.4.80.0000.01719.39
7.4.70.0100.00716.48
7.4.60.0100.01016.45
7.4.50.0000.01716.63
7.4.40.0080.01616.65
7.4.00.0040.00814.85
7.3.330.0060.00313.22
7.3.320.0000.00613.05
7.3.310.0050.00216.26
7.3.300.0030.00316.32
7.3.290.0000.00716.32
7.3.280.0090.00916.26
7.3.260.0090.00816.37
7.3.240.0090.01116.38
7.3.230.0060.01716.45
7.3.210.0090.00916.50
7.3.200.0130.01016.52
7.3.190.0100.00616.46
7.3.180.0030.01316.55
7.3.170.0070.01016.50
7.3.160.0130.00916.52
7.3.10.0080.00316.45
7.3.00.0060.00716.41
7.2.330.0040.01616.75
7.2.320.0100.01416.76
7.2.310.0090.00916.58
7.2.300.0100.00616.53
7.2.290.0130.00616.75
7.2.130.0080.00716.64
7.2.120.0040.01016.84
7.2.110.0080.00716.73
7.2.100.0100.00716.68
7.2.90.0070.00916.83
7.2.80.0290.00716.17
7.2.70.0260.00716.12
7.2.60.0270.00716.24
7.2.50.0050.01316.19
7.2.40.0090.00916.27
7.2.30.0360.00616.22
7.2.20.0310.00616.23
7.2.10.0440.00816.28
7.2.00.0360.00616.23
7.1.250.0060.00615.81
7.1.200.0000.01215.78
7.1.190.0650.00613.89
7.1.180.0850.00713.91
7.1.170.0050.01014.00
7.1.160.0920.00613.74
7.1.150.0910.00613.96
7.1.140.1320.01013.65
7.1.130.1130.00714.04
7.1.120.0940.00313.70
7.1.110.1140.00313.88
7.1.100.0100.00913.92
7.1.90.1210.01113.49
7.1.80.0610.00913.89
7.1.70.0080.00813.50
7.1.60.0290.00731.84
7.1.50.0290.01331.98
7.1.40.1170.01332.04
7.1.30.0670.01731.73
7.1.20.0170.01831.73
7.1.10.0310.00513.73
7.1.00.0220.00613.75

preferences:
64.89 ms | 400 KiB | 5 Q