Posted By

gdvickery on 03/02/09


Tagged

php file extension


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

jadedbat
luman
rezzz
fackz
NyX
rvkone


Get file extension in one line


 / Published in: PHP
 

This method is a bit faster and more reliable then using the "explode" method. Works with PHP 4.0.3 and up.

  1. $fileExt = pathinfo('myfile.txt', PATHINFO_EXTENSION); // Returns "txt"

Report this snippet  

You need to login to post a comment.