I think my problem is the syntax of printing an array, but I'm not sure. It could be the syntax of my regular expression or preg_match_all(). But I'm quite confused.
I want the code to search a text file, scoreboard[1].txt for URLs that end in "boxscore.html" I then want those URLs to be stored into an array called URLs, and then I want to echo the array, URLs to my screen.
Something is being echoed, but not what I want. It's a bunch of numbers that have spaces between them, or are on separate lines. Gobbledygook, if you ask me.
Will someone tell me where my error lies? Thanks in advance.
Here's my code:
<?php
$fd = fopen ("c:\WINDOWS\Desktop\scoreboard[1].txt","r");
$boxscoreURLs = array();
$URLs = array();
$pattern = "|boxscore.html|";
while (!feof ($fd))
{
$buffer = fgets($fd, 4096);
$URLs = preg_match_all ($pattern, $buffer, $boxscoreURLs, PREG_PATTERN_ORDER);
echo ($buffer);
echo ($URLs);
}
?>