Posted By

hyperwhat on 07/30/07


Tagged

regexp files


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

hudge
Abe
fackz


Get the extension of a filename


 / Published in: PHP
 

  1. preg_replace("/.*?\./", '', 'photo.jpg');

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: aglian on March 6, 2009

OR:

$fileInfo = pathinfo($file); echo $fileInfo['extension'];

You need to login to post a comment.