I often find myself doing quick checks like this:
if (!eregi(\'.php\', $fileName)) { $filename .= \'.php\'; }
But as eregi() was deprec
if (! stristr($fileName, '.php')) $filename.='.php';
moff's answser had the parameters backwards.
http://php.net/manual/en/function.stristr.php