Page 1 of 1

strcmp not working right

Posted: Wed Jun 25, 2003 10:51 am
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?

Posted: Wed Jun 25, 2003 1:37 pm
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