I use a small snippet like this. If your visitor is on about.php , $basename will be about .
$basename = substr(strtolower(basename($_SERVER['PHP_SELF'])),0,strlen(basename($_SERVER['PHP_SELF']))-4);
HTML There will be something like this.
<li><a href="index.php"<?php if ($basename == 'index') echo ' class="current"'; ?>>Home</a></li> <li><a href="about.php"<?php if ($basename == 'about') echo ' class="current"'; ?>>About</a></li>
source share