Home >Backend Development >PHP Tutorial >Get file extension function

Get file extension function

WBOY
WBOYOriginal
2016-07-25 09:09:291090browse
Usage: echo FileExtension("name.txt"); get txt
  1. function FileExtension($fstr){
  2. $retval = '';
  3. $pt = strrpos($fstr, ".");
  4. if ($pt) $retval = substr($fstr, $pt+1 , strlen($fstr) - $pt);
  5. return ($retval);
  6. }
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn