Re: Getting part of a string...Was protecting a file via php

From: Date: Tue, 16 Sep 2003 13:24:30 +0000
Subject: Re: Getting part of a string...Was protecting a file via php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162739@lists.php.net to get a copy of this message
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]; Cheers Jon

« previous php.general (#162739) next »