Source Code:
(back to article)
<?php $string1 = "abc"; $string2 = "abc"; $string3 = "123"; if ($string1 == $string2) { echo '$string1 == $string2 is true' . PHP_EOL; // this will be true, since the values of $string1 and $string2 are the same } if ($string1 === $string2) { echo '$string1 === $string2 is true' . PHP_EOL; // this will also be true, since the values and types of $string1 and $string2 are the same } if ($string1 === $string3) { echo '$string1 === $string3 is true' . PHP_EOL; // this will be false, since the type of $string1 is string and the type of $string3 is integer } else { echo '$string1 === $string3 is false' . PHP_EOL; }
Result:
Report an issue