Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Last active April 3, 2016 03:05
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/948252ed4eca570e6ca81b4e5c8371e9 to your computer and use it in GitHub Desktop.
Save kurozumi/948252ed4eca570e6ca81b4e5c8371e9 to your computer and use it in GitHub Desktop.
【PHP】League\Csvを拡張してCSVファイルの任意のカラムの重複したデータを削除するメソッドを追加
<?php
require_once 'vendor/autoload.php';
use Acme\Csv\Reader;
$str = <<<EOF
john,doe,1
jane,doe,2
foo,bar,3
EOF;
$reader = Reader::createFromString($str);
$result = $reader->fetchDeduplicate(1);
$result = iterator_to_array($result);
print_r($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment