menu active in php code example
Example 1: php show active page
$activePage = basename($_SERVER['PHP_SELF'], ".php");
Example 2: php show active page
<ul class="nav navbar-nav">
<li class="<?= ($activePage == 'index') ? 'active':''; ?>"><a href="index.php">Home</a></li>
<li class="<?= ($activePage == 'contact-us') ? 'active':''; ?>"><a href="contact-us.php">Contact</a></li>
</ul>