Page 1 of 1

Parsing Input for my Database

Posted: Sun Jun 26, 2005 3:43 pm
by Death
Hi guys,

Basically I want to put something like the following in a <TEXTAREA> and then add it to my database:

101|555|some text
130|666|more text

...that would be two rows. In this example I chose the bar (|) as the delimiter. Do I parse it myself ? What about the line feeds, do I need to worry about the \r\n vs. \n for Windows, Unix ?

Maybe there are some build-in functions for doing this ? An example would be nice.

Thanks.

Posted: Sun Jun 26, 2005 4:05 pm
by Death
I think I found it.

I can use explode() or split().

Does anyone know which is faster ?

Posted: Sun Jun 26, 2005 5:09 pm
by timvw
Why don't you give it a try? And let us know what your findings are :) And tell us if the differences are significant enough to care about ;)