I have a form that allows the user to either upload a text file or copy/paste the contents of the file into a textarea. I can easily differentiate between the two and put wh
preg_split the variable containing the text, and iterate over the returned array:
preg_split
foreach(preg_split("/((\r?\n)|(\r\n?))/", $subject) as $line){ // do stuff with $line }