Re: explode string variable

From: Date: Sat, 08 Mar 2003 19:10:29 +0000
Subject: Re: explode string variable
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-26196@lists.php.net to get a copy of this message
or just : $word = "James-Martin-Smith" $word_break = Array(); $first_dash = strpos($word, '-'); if ($first_dash !== false) { $word_break[0] = substr($word,0,$first_dash+1); $word_break[1] = substr($word,$first_dash+1,strlen($word)); } "André Sannerholt" <sannerholt@freenet.de> wrote in message news:20030308153707.73718.qmail@pb1.pair.com... > Hi everyone! > > Does anybody know how to "stop" an "explosion" of a string: Let me explain: > > $variable_aray=explode('-', $variable); > > I want the variable to be devided in only two other ones! If for example: > > $variable="Willy-Brandt-Platz-5" > > I want to have an array that looks like this: > > $variable_array[0] should be "Willy" > $variable_array[1] should be "Brandt-Platz" > > > Regards > > André > > >

« previous php.db (#26196) next »