# Comparison Operators in PHP

I got most of the information from the site PHP Comparison Operators. I also found the information from the book on this general topic to be most insightful. Previous to doing this weeks assignment I knew what the comparison operators were and thier basic function from working in other languages and from work in class.

### Comparison Operators

In PHP comparison operators allow you to compare two values. This can be done in 9 different ways. Each operation is different and will return a boolean true or false after the specified comparison.

**$a == $b (equal):**Returns true if $a is equal to $b.**$a === $b (identical):**Returns true if $a is equal to $b, and the same type.**$a != $b (not equal):**Returns true if $a is not equal to $b.**$a <> $b (not equal):**Returns true if $a is not equal to $b.**$a !== $b (not identical):**Returns true if $a is equal to $b, or not the same type.**$a < $b (less than):**Returns true if $a is strictly less than $b.**$a > $b (greater than):**Returns true if $a is strictly greater than $b.**$a <= $b (less than or equal to):**Returns true if $a is less than or equal to $b.**$a >= $b (greater than or equal to):**Returns true if $a is greater than or equal to $b.

Most of the time these are used in an IF or IF/ELSE statement, where based on the outcome of the comparison the comptuer would know how to proceed. I find it interesting that it does not matter witch comes first in the expression as long as you have the correct logic in the statement.

### Working Example / References

This is a hard one to show a working example of on the web. As far as references I did find that there are many out there. One really good one that goes really in depth is PHP Comparison Operators. This site not only shows how to work with the comparison operators but it also show how to manipulate them using built in fuctions. Also I like to look at the comments left by others, they seem to know what they are talking about and have good examples.