I'm trying to receive news information from a file called news.txt. What I did was this:
Code:
<?
$fp = fopen ("news.txt","r");
while ($news = fscanf ($fp, "%s\t%s\t%s\t$s\n") {
list ($date, $articlename, $time, $articlecontents) = $news;
print_r ($news);
}
fclose($fp);
?>
Output:
Array ( [0] => Thursday, [1] => April [2] => 14, [3] => 2001 )
Wanted Output:
Array ( [0] => Thursday, April 14, 2001 [1] => Article Name [2] => 12:34:33 pm [3] => This is a test article.
I don't know what it should be if I want the fscanf to search for a number of words like "Hello World" instead of just one "Hello" and "World".