<?php
$csv = <<<CSV
id: 10, location: Canada, people: 12
id: 10, location: United States, people: 15
id: 15, location: England, people: 19
id: 16, location: India, people: 20
id: 16, location: Germany, people: 9
CSV;
foreach (explode(PHP_EOL, $csv) as $line) {
$firstColumn = strtok($line, ',');
if (!isset($lookup[$firstColumn])) {
echo $line . PHP_EOL;
$lookup[$firstColumn] = true;
}
}
- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- id: 10, location: Canada, people: 12
id: 15, location: England, people: 19
id: 16, location: India, people: 20
preferences:
97.18 ms | 407 KiB | 5 Q