【PHP】League\Csvを拡張してCSVファイルの任意のカラムの重複したデータを削除するメソッドを追加
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 | |
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