Skip to content

Instantly share code, notes, and snippets.

@hakjoon
Created September 23, 2011 03:30
Show Gist options
  • Save hakjoon/1236686 to your computer and use it in GitHub Desktop.
Save hakjoon/1236686 to your computer and use it in GitHub Desktop.
Conditional CSV
<?PHP
$read = fopen("in.csv", "r");
$write = fopen("out.csv", "w");
while (!feof($read) ) {
$line = fgetcsv($read, 1024);
if ($line[2] == "what I want") {
fputcsv($write, $line);
}
}
fclose($read);
fclose($write);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment