PHP set active link on page using includes

Asumming you have a $page variable (which contains the name of the page you are currently on):

  <nav>
    <ul>
      <li class="<?php echo ($page == "home" ? "active" : "")?>"> <a href="/">Home</a> </li>
      <li class="<?php echo ($page == "apps" ? "active" : "")?>"> <a href="#">Apps</a> </li>
      <li class="<?php echo ($page == "forums" ? "active" : "")?>"> <a href="#">Forums</a> </li>
    </ul>
  </nav>

Here is a simple way where you do not need to add any other variable

<li class="<?php echo ($_SERVER['PHP_SELF'] == "/index.php" ? "active" : "");?>">
<a href="index.php">Start</a>
</li>
<li class="<?php echo ($_SERVER['PHP_SELF'] == "/about.php" ? "active" : "");?>">
<a href="about.php">About</a>
</li>
<li class="<?php echo ($_SERVER['PHP_SELF'] == "/practices.php" ? "active" : "");?>">
<a href="practices.php">Practices</a>
</li>