Page 1 of 1

line endingg

Posted: Tue Jan 18, 2005 8:37 am
by magicrobotmonkey
The specs for a project I'm working on require that I take new-line delimited information from a text box and put it into an array. I am having trouble trying to figure the best way to do this so that I can take input from macs, windows boxes, or linux boxes. Right now I just explode on "\r\n\" and that works fine, but I know its not going to work for a mac or for a linux machine. Has anyone run into this problem before? I am just trying to figure out a couple of str_replaces or something in the right order which will ensure that I get similar output from \r\n, \r, or \n.

Posted: Tue Jan 18, 2005 8:40 am
by feyd

Code: Select all

$arr = preg_split('#ї\r\n]+#', $yourText);
:)