PHP Basics : Comparison operators

Understanding what comparison operators are available in PHP code and when to use them for best results.

Tim Wells
3 min readJan 21, 2022

--

PHP comparison operators aren’t that much different from comparison operators in any other language but can be a cause of issues for new users due to the script comparison as well as the difference between equal and identical.

Let’s look at some basic comparison operators.

$a = 10;var_dump($a == 10);
var_dump($a == '10');

--

--