Re: Strings
| From: | Jay Greenspan | Date: | Tue, 12 Dec 2000 00:31:56 +0000 |
| Subject: | Re: Strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29783@lists.php.net to get a copy of this message | ||
or yet another way...
$newstr = substr($str,0,strrpos($str, "/")+1);
on 12/11/00 7:05 PM, Brandon Orther at brandon@webintellects.com wrote:
>
> I have a variable that uses "/" to separate words, and I want to take the
> last word of the string of and return everything before it. Here are some
> examples:
> /usr/test/because ==> /usr/test/
>
> /this/is/a/test ==> /this/is/a/
>
> is there an easy way to take everything past the last "/" off (the string
> changes so there will be different numbers of "/" and I only want the last
> word off.)??
>
> Thank you,
>
> --------------------------------------------
> Brandon
>