A function that obtains the file name extension
/*
Getfiletype
Usage: Getfiletype ($filename)
*/
function Getfiletype ($Filename) {
if (Substr_count ($Filename, ".") = = 0) {//Check if there is a. number in the file name.
Return return empty
} else if (substr ($Filename,-1) = = ".") {//check whether to. end, i.e. no extension
Return return empty
} else {
$FileType = STRRCHR ($Filename, "."); Cut from the. Number
$FileType = substr ($FileType, 1); Remove. No.
return $FileType; Return
}
}
$Filename = "TESTFILENAME.PHP4";
$Filename = Getfiletype ($Filename);
Echo $Filename; Print out PHP4
http://www.bkjia.com/PHPjc/316537.html www.bkjia.com true http://www.bkjia.com/PHPjc/316537.html techarticle a function that obtains the file name extension?/* Getfiletype usage: getfiletype ($filename) */function Getfiletype ($Filename) {if (Substr_count ($ Filename,.) = = 0) {//Check file name is ...