I often find myself doing quick checks like this:
if (!eregi(\'.php\', $fileName)) { $filename .= \'.php\'; }
But as eregi() was deprec
I generally create and endsWith function; or other simple string manipulation functions for this kind of stuff.
function endsWith($string, $end){ return substr($string, -strlen($end)) == $end; }