Re: Strings
| From: | Josh G | Date: | Tue, 12 Dec 2000 00:17:46 +0000 |
| Subject: | Re: Strings | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29777@lists.php.net to get a copy of this message | ||
This should work:
$tmp=explode("/",$string);
unset($tmp[sizeof($tmp)-1]);
$string = implode("/",$tmp);
Just not sure about the unset() call.... give it a try and let me know.
----- Original Message -----
From: "Brandon Orther" <brandon@webintellects.com>
To: "PHP User Group" <php-general@lists.php.net>
Sent: Tuesday, December 12, 2000 11:05 AM
Subject: [PHP] Strings
>
> 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>