RE: [PHP] splitting string
| From: | Chris W. Parker | Date: | Tue, 16 Nov 2004 22:38:31 +0000 |
| Subject: | RE: [PHP] splitting string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202236@lists.php.net to get a copy of this message | ||
M. Sokolewicz <mailto:tularis@php.net>
on Tuesday, November 16, 2004 12:47 PM said:
>> Chris W. Parker wrote:
>>
>>> Yes.
>>>
>>> $string = "$string1|$string2|$string3|$string4|$string5";
>>>
>>>
>>> $string_back = explode("|", $string);
>>>
> please explain... WHY is that better?
Well it's better because it's a lot easier to read for one and two
because the pipe is a relatively safe delimiter. Kelly has a good idea
about using a tab (\t) instead, but if we want to get *really* crazy
let's use something like $#*$(#*@(*$@ as a delimiter. For sure that's
not going to be duplicated on accident. :)
Chris.