==
does a numeric comparison: it converts both arguments to a number and then compares them. As long as $str1
and $str2
both evaluate to 0 as numbers, the condition will be satisfied.
eq
does a string comparison: the two arguments must match lexically (case-sensitive) for the condition to be satisfied.
"foo" == "bar"; # True, both strings evaluate to 0.
"foo" eq "bar"; # False, the strings are not equivalent.
"Foo" eq "foo"; # False, the F characters are different cases.
"foo" eq "foo"; # True, both strings match exactly.