Re: splitting string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 Nov 2004 12:01:04 -0600, Afan Pasalic <afan@xxxxxxxx> 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/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux