Skip to content

Instantly share code, notes, and snippets.

@kiang
Created September 25, 2024 07:40
Show Gist options
  • Save kiang/e04ed89fb4036ae994df96b2b5af383d to your computer and use it in GitHub Desktop.
Save kiang/e04ed89fb4036ae994df96b2b5af383d to your computer and use it in GitHub Desktop.
a simple script to parse csv data
<?php
$fh = fopen(__DIR__ . '/map.csv', 'r');
$oFh = fopen(__DIR__ . '/result.csv', 'w');
fputcsv($oFh, ['編號', '行政區', '照片', '看板位置']);
fgetcsv($fh);
while ($line = fgetcsv($fh)) {
fputcsv($oFh, [$line[7], $line[4], $line[1], "https://www.google.com/maps?q={$line[6]},{$line[5]}"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment