twitterfacebookgoogle plusrss feed

Pages

Wednesday, July 4, 2012

Get file extension


You can use two easy functions to get the file extension in PHP

First


$file = "file.torrent";
echo substr($file,strrpos($file,"."));

Second


$file = "this.is.file.txt";
echo strrchr($file,".");

0 comments:

Post a Comment

comment or ask