Re: getting part of a string
| From: | Micah Montoy | Date: | Wed, 09 Jul 2003 04:51:41 +0000 |
| Subject: | Re: getting part of a string | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154487@lists.php.net to get a copy of this message | ||
That worked like a charm.
thanks a lot
"Ulf Sundin" <majikthse@spray.se> wrote in message
news:20030709043139.46616.qmail@pb1.pair.com...
> try basename(). then just cut the extention with substr($string, 0, -4)
(-4
> if the extention is 4 characters i.e. .gif)
>
> Regards
> Ulf
>
>
> "Micah Montoy" <montmica@isu.edu> skrev i meddelandet
> news:20030709041817.33748.qmail@pb1.pair.com...
> > Anyone have a sure way of grabbing just the file name from a string that
> > looks like this:
> >
> > C:/Documents and Settings/Bobo the Bugbear/My Documents/My
Pictures/1.gif
> >
> > I would like to pull off, just the name "1.gif" or even better just
> > "1"
> > without the extension.
> >
> > I've been working on:
> >
> > $filevalue = str_replace("\\\\", "/", $filevalue);
> >
> > $parts = explode("/",$filevalue);
> > $file_name = $parts[count($parts)];
> >
> > but with no luck.
> >
> > thanks
> >
> >
>
>