Re: Parse Question Using list()

From: Date: Fri, 02 Oct 2009 13:56:20 +0000
Subject: Re: Parse Question Using list()
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-298477@lists.php.net to get a copy of this message
> > Use the tool that PHP provides for such problems. > > http://php.net/fgetcsv fgetcsv is very useful, here a example: <?php $row = 1; /* load file*/ $handle = fopen("log.csv", "r"); /* read line by line */ while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); ?> -- Gerardo Benitez

« previous php.general (#298477) next »