I used this simple function to determine the file extension of files on my site so i can put a unique icon next to each file thats listed. If you would like the icons (they are very small as designed for mobile/wap sites) you can get them at my wap site http://cult.toddywap.com
<?
//icon code
$icon = "unknown.gif";
$rev = strrev ($file_name);
$exp = explode (".", $rev);
$true = strrev ($exp[0]);
$trueext = strtolower ($true);
if ($trueext=="zip" OR $trueext=="rar" OR $trueext=="gz"){$icon = "zip.gif";}
if ($trueext=="amr"){$icon = "amr.gif";}
if ($trueext=="midi"){$icon = "midi.gif";}
if ($trueext=="mid"){$icon = "mid.gif";}
if ($trueext=="gif"){$icon = "gif.gif";}
if ($trueext=="jpeg"){$icon = "jpeg.gif";}
if ($trueext=="jpg"){$icon = "jpg.gif";}
if ($trueext=="jad"){$icon = "jad.gif";}
if ($trueext=="jar"){$icon = "jar.gif";}
if ($trueext=="sis"){$icon = "sis.gif";}
if ($trueext=="bmp"){$icon = "bmp.gif";}
if ($trueext=="wbmp"){$icon = "wbmp.gif";}
if ($trueext=="txt"){$icon = "txt.gif";}
if ($trueext=="avi"){$icon = "avi.gif";}
if ($trueext=="thm"){$icon = "thm.gif";}
if ($trueext=="nth"){$icon = "nth.gif";}
if ($trueext=="png"){$icon = "png.gif";}
if ($trueext=="mmf"){$icon = "mp4.gif";}
if ($trueext=="wav"){$icon = "wav.gif";}
?>