Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created January 30, 2016 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/d9da94320f84676f9ee3 to your computer and use it in GitHub Desktop.
Save kurozumi/d9da94320f84676f9ee3 to your computer and use it in GitHub Desktop.
【PHP】CSVファイルの先頭から10行目までを読み込む方法
<?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