3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $items = array( "Home", "Pages" => array( "About", "Services", "Products", "Contact", "FAQs", "Sitemap", "Privacy Policy" ), "Column Layouts" => array( "1 Column", "2 Column (Left Sidebar)", "2 Column (Right Sidebar)", "3 Column", "4 Column" ) ); echo "<ul>"; function getMenu($array) { foreach($array as $key => $value) { if(is_array($value)) { echo "<li>" . $key . "</li>"; echo "<ul>"; getMenu($value); echo "</ul>"; } else { echo "<li>" . $value . "</li>"; } } } echo "</ul>"; getMenu($items);
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
<ul></ul><li>Home</li><li>Pages</li><ul><li>About</li><li>Services</li><li>Products</li><li>Contact</li><li>FAQs</li><li>Sitemap</li><li>Privacy Policy</li></ul><li>Column Layouts</li><ul><li>1 Column</li><li>2 Column (Left Sidebar)</li><li>2 Column (Right Sidebar)</li><li>3 Column</li><li>4 Column</li></ul>
Output for hhvm-3.10.0

Process exited with code 153.