|  | Posted by Kevin Raleigh on 08/17/07 02:40 
I need to read a file of names and email addresses
 I can use fgets() to read each line, but I am not sure
 how to use strtok($myString, "\n") to parse the
 individual elements on each line.
 
 Jon Doe    myemail@aol.com
 
 tab delimited ^^
 
 what I have is a very crude attempt:
 $file = @fopen("test_email.txt", "r") or exit("Unable to open file!");
 
 while (!feof($file)) {
 $myString = fgets($file, 4096);
 $token = strtok($myString, "\n");
 
 while ($token !== false)
 {
 echo "$token<br/>";
 $myString = strtok($myString, "\n");
 }
 }
 fclose($handle);
 
 what I have just locks up the browser
 
 insight would be appreciated
 thank you
 Kevin
 [Back to original message] |