Reputation: 17333
I have two strings, which, when both outputted with echo
, produce the same result:
x+3=7\\\\x+3-3=7-3\\\\\\thereforex=4
Yes, it's a bit of LaTeX.
But when I use:
$foo1 == $foo2
PHP takes it as false. Why? Do I need to do something? Did I not introduce the problem yet?
Upvotes: 1
Views: 78
Reputation: 146440
You can't be fully sure that both strings are identical with plain echo's, especially if inspecting output through the rendered view of a web browser. Tools you have:
Upvotes: 2
Reputation: 95101
You are mostly likely dealing with whitespace
or Special Characters
See
$foo1 = 'x+3=7\\\\x+3-3=7-3\\\\\\thereforex=4';
$foo2 = 'x+3=7\\\\x+3-3=7-3\\\\\\thereforex=4';
var_dump($foo1 == $foo2); // returns true
Use var_dump
you would see the real difference between them
Upvotes: 1