Comparison Operators

Comparison Operators

PHP comparison operators are used to compare two values and return a boolean value (true or false) based on the result of the comparison. The comparison operators include:

  1. Equal to (==): This operator checks if two values are equal to each other, regardless of their data type.
  2. Identical to (===): This operator checks if two values are equal to each other and are of the same data type.
  3. Not equal to (!=): This operator checks if two values are not equal to each other, regardless of their data type.
  4. Not identical to (!==): This operator checks if two values are not equal to each other and are of different data types.
  5. Greater than (>): This operator checks if the first value is greater than the second value.
  6. Less than (<): This operator checks if the first value is less than the second value.
  7. Greater than or equal to (>=): This operator checks if the first value is greater than or equal to the second value.
  8. Less than or equal to (<=): This operator checks if the first value is less than or equal to the second value.

Comparison operators are commonly used in if statements and loops to make decisions based on the result of the comparison.

Apply for PHP Certification!

https://www.vskills.in/certification/certified-php-developer

Back to Tutorials

Sorting editing and deleting with the GridView
Viewing Options

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?