I often find myself doing quick checks like this:
if (!eregi(\'.php\', $fileName)) {
$filename .= \'.php\';
}
But as eregi() was deprec
Of course you are aware, that this doesn't do what you expect it do do?
In regexp '.' means any character, so eregi('.php',$fileName)
means filename with any character followed by 'php'. Thus for example "blabla2PHP.txt" will match your regexp.
Now what you want to do is this:
$file_ext = pathinfo($filename, PATHINFO_EXTENSION);
if(strtolower($file_ext) != 'php')
$filename .= '.php';