Created
January 30, 2016 00:35
-
-
Save kurozumi/d9da94320f84676f9ee3 to your computer and use it in GitHub Desktop.
【PHP】CSVファイルの先頭から10行目までを読み込む方法
This file contains 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 | |
$file = new SplFileObject("sample.csv"); | |
$file->setFlags(SplFileObject::READ_CSV); | |
foreach(new LimitIterator($file, 0, 10) as $line) | |
{ | |
var_dump($line); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment