String comparison failing

[php]
$a = exec(“a.out1 <input1”);

$b = exec(“a.out2 <input2”);

if(strcmp($a,$b)==0){

}
else{
// this always executes

} [/php]
The two strings $a and $b are both “Miles per gallon = 10”.

I have checked both variables using var_dump(bin2hex($a)) and get
dump1= string(42) “4d696c6573207065722067616c6c6f6e203d203130”
dump2= string(42) “4d696c6573207065722067616c6c6f6e203d203130”

Any idea on what’s happening?

… Now it’s working? I don’t know. I’ve altered code here and there. It’s possible that because I added and html encode/decode statement with the values coming into the page.

Thanks though

OK, I lied. It isn’t working. While testing I added a negation in the if statement that caused it to be true every time. Any one have a clue? I’ve been tinkering with it work quite a while but to no avail.

Sponsor our Newsletter | Privacy Policy | Terms of Service