* Thus wrote Jon Haworth ([EMAIL PROTECTED]): > Hi Steve, > > > $pfile = str_replace('get.php?file=','','$file'); > > $p = explode('.', $pfile); > > // How do I say look at the extension and put it into the switch? > > $extension = $p; > > // end of the bit I'm stuck on. > > At this point $p is an array rather than a variable, so you'll need to get > the last element of $p.Try something like this: > > $p = explode('.', $pfile); > $extension = $p[sizeof($p)-1];
I always consider explode to be overkill when a simple: $extension = substr($pfile, strrpos($pfile, '.')+1); would do. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php