I have a loop that will not end
in the list.txt file I have 4 lines
text1
text2
text3
text4
in the link.txt file I have 4 lines
when I run the code the last link/text4 is created and is continuing to be created and will not stop unless I stop the browser - I do not see what is wrong with my 'for' code please help
any help would be appreciated
in the list.txt file I have 4 lines
text1
text2
text3
text4
in the link.txt file I have 4 lines
when I run the code the last link/text4 is created and is continuing to be created and will not stop unless I stop the browser - I do not see what is wrong with my 'for' code please help
any help would be appreciated
Code:
<?php
$line = 1;
//load list.txt file into an array each line will be a menu item
$listhandle = fopen("[URL unfurl="true"]http://www.fakedomain.com/list.txt",[/URL] "r"); //open file with readonly access as list handle variable
$linkhandle = fopen("[URL unfurl="true"]http://www.fakedomain.com/link.txt",[/URL] "r"); //open file with readonly access as link handle variable
while (!feof($listhandle)) {
$listbuffer = fgets($listhandle, 4096); //retrive line from file and stores it in the list buffer variable
$linkbuffer = fgets($linkhandle, 4096); //retrive line from file and stores it in the link buffer variable
$zlist[$line] = $listbuffer;
$zlink[$line] = $linkbuffer;
$line++; //increment line variable
}
fclose($listhandle); //Close file
fclose($linkhandle); //Close file
echo "<body>";
for ($i = 1; $i = count($zlist); $i++){
echo "<p><a href=$zlink[$i]>$zlist[$i]</a></p>\n";
}
echo "</body>";
?>