You are here: Re: Processing data from a text area, one line at a time « PHP Programming Language « IT news, forums, messages
Re: Processing data from a text area, one line at a time

Posted by Jeff North on 09/13/07 21:59

On Thu, 13 Sep 2007 14:02:17 -0700, in comp.lang.php Anthony Smith
<mrsmithq@hotmail.com>
<1189717337.618895.272990@d55g2000hsg.googlegroups.com> wrote:

>| 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.
-- -------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация