== and ===
== compares after type juggling, === compares value and type. Use === by default. The spaceship <=> returns -1, 0 or 1.
Example
var_dump(0 == "a", "1" == "01", "abc" === "abc", 1 === "1");
echo 1 <=> 2, " ", 2 <=> 2, " ", 3 <=> 2;Result
bool(false) bool(true) bool(true) bool(false) -1 0 1
Exercise
Strict equal.
1 "1"
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.