You might want to reconsider the return value. Instead of returning false if it has PHP, why not return true if it does? What about this?
function containsPhp($string) {
return strstr($string, 'php');
}
Then you could do this
$filetype = "file.php.jpg";
// does it contain php in it?
var_dump(containsPhp($filetype));
UPDATE
If you know for certain it will always appear as '.php.', then simply change the second argument of the strstr() function.
If you want the file extension, consider the following function.
function getFileExtension($filePath) {
$filename = basedir($filePath); // this may not be required.
return pathinfo($filename, PATHINFO_EXTENSION);
}
}