Get File Extension


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



Copy this code and paste it in your HTML
  1. /**
  2. *
  3. * @Get File extension from file name
  4. *
  5. * @param string $filename the name of the file
  6. *
  7. * @return string
  8. *
  9. **/
  10. function getFileExtension($filename){
  11. return substr($filename, strrpos($filename, '.'));
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.