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