Get file extension from name or complete path


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

Get file extension from it's name or complete path


Copy this code and paste it in your HTML
  1. <?php
  2. function get_extension($file) {
  3. $extension = end(explode(".", $file));
  4. return $extension ? $extension : false;
  5. }
  6. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.