RSS

Tag Archives: echo file extension PHP

Getting file extension using PHP

#strrpos($string, $delimeter) -  returns the numeric position of the final occurence of the delimeter in the string.

#substr($string, $position) – returns a partial of the string which starts at the $position being declared

$file_extension = substr($filename,  strrpos($filename, “.”));
echo $file_extension

 
Leave a comment

Posted by on January 19, 2010 in PHP

 

Tags: ,

 
Follow

Get every new post delivered to your Inbox.