Get a filename extension


/ Published in: PHP
Save to your folder(s)

Gets a filename's extention.


Copy this code and paste it in your HTML
  1. //gets a filenames extension
  2. function filename_extension($filename) {//{{{
  3. $pos = strrpos($filename, '.');
  4. if($pos===false) {
  5. return false;
  6. } else {
  7. return substr($filename, $pos+1);
  8. }
  9. }//}}}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.