3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Stick this with your helper functions function buildMenu($navigation, $currentPage){ echo '<ul>'; foreach ($navigation as $key => $val) { $class = $val === $currentPage ? 'on' : 'off'; echo '<li>'; if( is_array($val) ){ echo '<a href="#" class="' . $class . '">' . $key . '</a>'; buildMenu($val, $currentPage); } else { echo '<a href="' . $val . '" class="' . $class . '">' . $key . '</a>'; } echo '</li>'; }; echo '</ul>'; }; // Define current page $currentPage = 'club.php'; // Build up your navigation arrays $navigation = array( 'News' => '#', 'About' => array( 'Club' => 'club.php', 'Coaches' => 'coaches.php', 'Officials' => 'officials.php', 'Management' => 'management.php' ) ); // Build HTML buildMenu($navigation, $currentPage);
Output for git.master, git.master_jit, rfc.property-hooks
<ul><li><a href="#" class="off">News</a></li><li><a href="#" class="off">About</a><ul><li><a href="club.php" class="on">Club</a></li><li><a href="coaches.php" class="off">Coaches</a></li><li><a href="officials.php" class="off">Officials</a></li><li><a href="management.php" class="off">Management</a></li></ul></li></ul>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
53.03 ms | 402 KiB | 8 Q