Strcmp outputs a negative value when comparing files
What I need to know is why my strcmp
outputs -11?
I have checked both files, the result is the same as
Magnum 23-08-2011 1st 0006,2nd 0661,3rd 6358,S:2359,5341,3075,4048,3720,8648,2774,7109,6360,1422,C:6149,0303,4841,3606,0076,2648,6736,7978,5986,7051
Here is my code:
$checkfile2 = fopen("/var/www/html/magnum/check.txt","r")开发者_C百科;
fclose($checkfile2);
$checkfile3 = fopen("/var/www/html/magnum/result/".$Current."Magnumresult.txt","r");
fclose($checkfile3);
echo strcmp($checkfile2, $checkfile3);
Thank you, hope you guys reply to me soon.
fopen() function return a file pointer resource not string. So you are getting the error.
If you want to compare contents of each file then use file_get_contents() function to get the contents of each file.
精彩评论