PHP String Comparison

Viewed 5258

I have two strings that look the same when I echo them, but when I var_dump() them they are different string types:

Echo:
http://blah
http://blah
var dump:
string(14) "http://blah"
string(11) "http://blah"
strToHex:
%68%74%74%70%3a%2f%2f%62%6c%61%68%00%00%00
%68%74%74%70%3a%2f%2f%62%6c%61%68

When I compare them they return false. How can I manipulate the string type so that I can perform a comparison that returns true. What is the difference between string 11 and string 14? I am sure there is a simple resolution but have not found anything yet, no matter how I implode, explode, UTF8 encode etc the strings they will not compare or change type.

Thanks for your help!

Peter.

6 Answers
Related