Problem with reading txt file
Posted: Wed Jan 01, 2003 6:19 pm
Here's my PHP code to read from a file called News.txt:
here's what is in the News.txt file:
The problem with this code is that it adds the <br> to the <hr> even with the if statements saying not to.
any help on why it does this would be greatly appreciated. thanks.
Code: Select all
<?php
$fcontents = file ('News.txt');
while (list ($line_num, $line) = each ($fcontents)) {
$line = str_replace("/New", "<hr>", $line);
echo $line;
if ($line != "<hr>") { echo "<br>"; }
}
?>Code: Select all
<b>Site Coming Soon!</b>
/New
1/1/2003 - Happy New Year!
Happy New Years all!!!any help on why it does this would be greatly appreciated. thanks.