Re: Strings

From: Date: Tue, 12 Dec 2000 07:18:27 +0000
Subject: Re: Strings
Groups: php.general 
Request: Send a blank email to php-general+get-29828@lists.php.net to get a copy of this message
Addressed to: "Josh G" <josh@gfunk007.com> "Brandon Orther" <brandon@webintellects.com> "PHP User Group" <php-general@lists.php.net> ** Reply to note from "Josh G" <josh@gfunk007.com> Tue, 12 Dec 2000 11:17:46 +1100 > > This should work: > > $tmp=explode("/",$string); > unset($tmp[sizeof($tmp)-1]); > $string = implode("/",$tmp); > I may as well throw in one more way... $Tmp = explode( '/', $string ); array_pop( $Tmp ); $string = implode( '/', $Tmp ); array_pop() array_push() array_shift() array_unshift() are a cool way to add and remove things from either end of an array, without having to know its size. In this case I use pop to remove the last entry, and toss it into the bit bucket. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.general (#29828) next »