doingword.com

How to get the extention of the file with php with strrchr function

November 10th, 2007

Hi guys,
With this code you can get the extension of a file. This is very simple and useful.

  1. $ext = strrchr($file,".");

If the value of $file is “/files/games/mathattach.swf” the value of $ext will be “.swf”;

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Entry Filed under: Php, tip


Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed