setDelimiter(';'); $res = $inputCsv ->addFilter(function ($row, $index) { return $index > 0; //we don't take into account the header }) ->addFilter(function ($row) { return isset($row[1], $row[2], $row[3]); //we make sure the data are present }) ->addFilter(function ($row) { return 10 > $row[1]; //the name is used less than 10 times }) ->addFilter(function ($row) { return 2010 == $row[3]; //we are looking for the year 2010 }) ->addFilter(function ($row) { return 'F' == $row[2]; //we are only interested in girl firstname }) ->addSortBy(function ($row1, $row2) { return strcmp($row1[1], $row2[1]); //we order the result according to the number of firstname given }) ->setLimit(20) //we just want the first 20 results ->fetch(); //get the headers $headers = $inputCsv->fetchOne(0); ?>
=implode(' | '.PHP_EOL.'', $headers), ' | ', PHP_EOL; ?>
---|---|
=implode(' | '.PHP_EOL.'', $row), ' | ', PHP_EOL; ?>