Last active
August 29, 2015 14:06
-
-
Save dol/ae2c6284e7a691f10313 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$content = <<<'EOF' | |
Line 1 | |
Line 2 | |
Line 3 | |
Line 4 | |
EOF; | |
$tmpCsvFile = new SplTempFileObject(); | |
$tmpCsvFile->fwrite($content); | |
$iterator = new CallbackFilterIterator($tmpCsvFile, function ($row) { | |
return true; | |
}); | |
echo 'Limit 2: ', iterator_count(new LimitIterator($iterator, 2)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 2)), "\n"; | |
echo 'Limit 3: ', iterator_count(new LimitIterator($iterator, 3)), ' ', iterator_count(new LimitIterator($tmpCsvFile, 3)), "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment