Re: getting part of a string

From: Date: Wed, 09 Jul 2003 04:31:40 +0000
Subject: Re: getting part of a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154486@lists.php.net to get a copy of this message
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 > >

« previous php.general (#154486) next »