strcmp not working right

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
slipstream
Forum Commoner
Posts: 86
Joined: Fri Apr 19, 2002 8:53 am
Location: Canada

strcmp not working right

Post by slipstream »

I am testing string like so,,

for ($i=0; $i < $numlines;$i++)
{
echo $file[$i].' '.$testLine;
if (strcmp($file[$i],$testLine))
{
echo 'same';
fwrite($fp,$file[$i]);
}
}

when I echo it, it gives me 2 different strings but ALWAYS goes into the echo 'same' code?
slipstream
Forum Commoner
Posts: 86
Joined: Fri Apr 19, 2002 8:53 am
Location: Canada

Post by slipstream »

nevermind I got it.

I was comparing the /n so I just had to trim it before I compared it, sorry for posting. :D
Post Reply