CSS page selected with PHP

Hello,
I developed a nice little php function for having a CSS hyperlink have a different style if you are on the hyperlinks page. You can also make this much more complex with features such as making the hyperlink inactive if you are on the page and of course more styling of the fonts
PHP function (put this on the page or in a PHP include file)
function WhichPage($thepage)
  {
// this gets the name of the php page you are presently on
$page = basename($_SERVER[“PHP_SELF”]); 

if ($page == $thepage) {
// style for selected state 
  echo “menu_selected”;
  
} else {
// default style 
 echo “menu”; 
}
}
CSS style (customize as you wish)
A.menu:ACTIVE, A.menu:FOCUS, A.menu:LINK, A.menu:VISITED {
color : #e87d1e;
font-family : Verdana, Helvetica, sans-serif;
}

A.menu:HOVER {
color : #54b948;
font-family : Verdana, Helvetica, sans-serif;
}


A.menu_selected:ACTIVE, A.menu_selected:FOCUS, A.menu_selected:LINK, A.menu_selected:VISITED {
color : #54b948;
font-family : Verdana, Helvetica, sans-serif;
}
A.menu_selected:HOVER {
font-family : Verdana, Helvetica, sans-serif;
color : #e87d1e;
}
HTML MENU (customize as you wish)
// HTML:  be sure to send the page name in the function, i use include files for my menu  (I have one file which controls the menu for every page in the website) so i need to specify here.
<a href=”about_staff.php” class=”<?php WhichPage(“about_staff.php”); ?>”> Staff </a>