Get filename without extension


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



Copy this code and paste it in your HTML
  1. /**
  2.  * Get filename without the extension
  3.  *
  4.  * @param string $filename File name
  5.  * @return string Filename without the extension
  6.  */
  7. function dropExtension($filename) {
  8. return substr($filename, 0, strrpos($filename, "."));
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.