You are here: file read and strtok « PHP Language « IT news, forums, messages
file read and strtok

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация