On Thu, 13 Sep 2007 14:02:17 -0700, in comp.lang.php Anthony Smith
<mr******@hotmail.com>
<11**********************@d55g2000hsg.googlegroups .comwrote:
>| I am allowing the use to cut and paste comma delimited data. How do I
| process the data one line at a time?
$lines = explode("\n", $data);
for($idx=0; $idx<count($lines); $idx++) {
$commas = explode(",", $lines[$idx]);
// do whatever
}
Note: you will obviously need to do more checking when exploding each
line. The data could look like:
123,"this is a line of text",123
123,"He said, 'this is a new sentence'.",123
The second example will return a length of 4.
-- -------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------