Still problem with files
| From: | Beauford.2005 | Date: | Thu, 17 Jul 2003 04:18:09 +0000 |
| Subject: | Still problem with files | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155719@lists.php.net to get a copy of this message | ||
Hi,
Sorry for the extra emails, but I thought I had this licked, but now
other problem pop up. As I said, I have a file with many lines like
<Option Value="3">Alfredsson in it. I have been able to read the file
into an array and display it, but I am trying to do a comparison IF
statement and no matter what I try I can't figure out what to compare.
To explain better here is my code so far.
$filename = "players.inc";
$fd = fopen ($filename, "r");
while (!feof ($fd)) {
$buffer = fgets($fd);
$list[] = $buffer;
}
fclose ($fd);
for($i = 0; $i < 131; $i++) {
if($list[$i] != ????????? {
echo "<BR>".htmlspecialchars($list[$i]); }
}
So using the example above what would I use where the question marks are
if I wanted to display everything but this line - <Option
Value="3">Alfredsson. I have tried a variety of ways to do this:
i.e
$p = "<Option Value=\"131\">Alfredsson";
for($i = 0; $i < 131; $i++) {
if(htmlspecialchars($list[$i]) != $p) {
echo "<BR>".htmlspecialchars($list[$i]);
}
}
This is just a sample script that I want to get running before I
actuaaly put it into use, so any help is appreciated.