Get file extension


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



Copy this code and paste it in your HTML
  1. $filename = 'image.jpg';
  2.  
  3. $file = pathinfo($filename);
  4. echo $file['extension']; // output: jpg

URL: http://php.net/manual/en/function.pathinfo.php

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.