Determining the relationship between two strings is not as immediately obvious a feat as performing the same operation on two numbers. The main problem with strings is one of context. If you examine a string based on its binary form, the two words "Marco" and "marco" will be completely different because the byte value of the character "M" ishas to bedifferent from the value of "m". However, depending on your requirements, Marco and marco could be equivalent and should be treated as such.
The easiest way to compare two strings is to use the built-in PHP comparison operators. However, there are a few "gotchas" that you should be aware of. Consider, for example, the following expression:
echo (0 == '0');
Because one of the operators is an integer, the string "0" is converted to an integer value before the conversion is made, resulting in the output 1. Now, this may not look like much of a problem at first sight, but it can very easily become one when something like this happens:
echo (0 == 'Marco');
Because the string 'Marco' is converted to the integer value 0 when the expression is evaluated, the result of the comparison operation is still true, and the preceding code snippet outputs 1. Now, there's a good chance that you will never want something like this to happen to your code and, therefore, you should never use the simple comparison operators when dealing with strings unless you really know what you're doing.