I am trying to run through a dictionary, .txt file, calculate the metaphone()
values and append that to each line. Then write this to a new file.
I am getting an error though on the line that I am using fputcsv()
and it says: expects parameter 1 to be resource, boolean given
I don't believe I am passing it a boolean. I don't understand what I am doing wrong.
<?php
$dict = fopen("originalDictionary.txt", "r");
$keyedDict = fopen("dictionary.txt", "w");
while ($line = fgets($dict)){
$line = trim(strtolower($line));
fputcsv($keyedDict, array($line,metaphone($line)));
}
fclose($dict);
fclose($keyedDict);
?>
Here is a link to originalDictionary.txt if that helps.