Here's what I'm doing:
<?php
$csvObj = new Csv2Parser($file);
$csvObj->loopContents();
$csvObj->looplimitrows = 9; // why does this get ignored?
?>
This looplimitrows is always returning 5 rows, instead of the 9 I am wanting. Am I not doing it right?
Here's the Class:
class Csv2Parser
{
private $filepath;
public $looplimitrows = 5;
/*
.... __construct() goes here...
*/
public function loopContents(){
$looplimitrows = $this->looplimitrows;
$linecount=0;
$fp = fopen($targetFile, "r"); // open the file
while ($line = fgetcsv($fp)) {
$linecount++;
if(!empty($looplimitrows) && $linecount > $looplimitrows){ break; }
echo $line[0]; // first column only
}//eof while()
}