$files = substr($filename,0,(strlen ($filename)) - (strlen (strrchr($filename,'.')
To be honest, I added the code because I did not want to be too far behind the codemaster who sits next to me in class (no, really, he is a nearly graduated Computer Information Technology major who knows more programming languages than I know foreign languages--even counting the languages that I only know a handful of words in). When we got to class we compared projects and he had something like this:
$files = array("mule.php" => "Mule", "chicken.php" => "Chicken"))
The garbably-goob is the cool difference. His code (the standard that most of us shoot for) basically says: "If you have a friend named 'Mule' then link it to mule.php and if you have a friend name 'Chicken' then link it to chicken.php." That was fine, and definitely high standard for the class, but this list would need to be updated whenever a new page was added, and I, being a lazy programmer, am not okay with constantly updating random strings.
My code on the other hand says: "Look, I am a lazy web site builder and I don't want to have to tell you every time I add a page, besides you are a big web server wearing big web server pants, so go write your own list, make it pretty and keep it up-to-date."
That earned me a Gold Star from the codemaster. It still makes me smile.