Re: Split string

From: Date: Fri, 04 May 2007 00:23:15 +0000
Subject: Re: Split string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-254380@lists.php.net to get a copy of this message
if ($your_string !== ''){ $arr_string = explode(',', $your_string); $first_part = $arr_string[0]; array_shift($arr_string); $second_part = implode(',', $arr_string); } -- itoctopus - http://www.itoctopus.com "Lester Caine" <lester@lsces.co.uk> wrote in message news:4638521A.3090304@lsces.co.uk... > Can someone with a few more working grey cells prompt me with the correct > command to split a string. > > The entered data is names, but I need to split the text up to the first > space or comma into one string, and the rest of the string into a second. > It's the 'first either space or comma' that eludes me at the moment :( > > In know it's probably obvious, but it always is when you know the answer. > > -- > Lester Caine - G8HFL > ----------------------------- > Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact > L.S.Caine Electronic Services - http://home.lsces.co.uk > MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/ > Firebird Foundation Inc. - http://www.firebirdsql.org/index.php

« previous php.general (#254380) next »