Re: splitting string
| From: | Greg Donald | Date: | Tue, 16 Nov 2004 19:00:36 +0000 |
| Subject: | Re: splitting string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202199@lists.php.net to get a copy of this message | ||
On Tue, 16 Nov 2004 12:01:04 -0600, Afan Pasalic <afan@afan.net> wrote:
> I create a string from other strings:
> $string =
> $string1."\n".$string2."\n".$string3."\n".$string4."\n".$string5;
> and then store it in DB.
>
> But, I can't figure out how to split them back?
>
> Tried:
> $string_back = explode('\n', $string);
Double quotes will cause the value to be evaluated as a newline
character. The single quotes will not. Use "\n" instead like you did
when you made the string.
> Also, is there actially better way to do this then adding \n between
> strings?
You can use whatever works. I use the pipe | character, it's pretty
standard and I've never seen it used as anything except a delimiter.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/