Home >Backend Development >PHP Tutorial >File extension A function that gets the file extension
A function to get the file extension
/*
GetFileType
Usage: GetFiletype($filename)
*/
function GetFiletype($Filename) {
if (substr_count($Filename, ".") == 0 ) { // Check whether there is a . number in the file name.
return; Return empty
} else { Y $ FileType = Strrchr ($ FILENAME, "."); // Cut at.
$Filename = "Testfilename.php4";
$Filename = GetFileType($Filename);
echo $Filename;
The above introduces the file extension. A function to obtain the file extension, including the content of the file extension. I hope it will be helpful to friends who are interested in PHP tutorials.