On Thursday 17 July 2003 12:18, Beauford.2005 wrote:
> 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);
Using file() instead of the above would be much easier.
> 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:
If you're going to be using file() then:
if($list[$i] != "<Option> Value=\"3\">Alfredsson\n";
Note the \n, substitute for whatever CR/LF characters are present in your
file because file() leaves them intact.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Don't expect people to keep in step--it's hard enough just staying in line.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php