Skip to content

Instantly share code, notes, and snippets.

@andydempster
Created November 22, 2019 18:42
Show Gist options
  • Save andydempster/a203234d2470963d36b923f7e6cceda9 to your computer and use it in GitHub Desktop.
Save andydempster/a203234d2470963d36b923f7e6cceda9 to your computer and use it in GitHub Desktop.
Find and Replace in a CSV
<?php
require_once('countries.php');
$row = 0;
$fp = fopen('hubspot10daysnew.csv', 'w');
$countries = get_countries();
if (($handle = fopen("hubspot10days.csv", "r")) !== FALSE) {
while ($data = fgetcsv($handle)) {
$data[4] = get_country($data[4]);
fputcsv($fp, $data);
echo "Processed line ".$row++."\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment