Clan Adverts

DarkForge Gaming

 

Comparison Syntax

Description: Learn about comparison syntax, equalities, inequalities, and others.
Version: 1.0
Added on: 24 February 2007
Author: unknown
Difficulty Level: Very Easy
Views: 346
Detailed Profile

Many people are often confused of when to use these equality syntaxes. This tutorial will explain in detail how to use them.

== is equal to

Code:

if($a == $b){
echo"$a is equal to $b";
}


This is not case sensitive, so if $a is MICHAEL and $b is Michael, it will still return a true value.


=== is identical to
Similar to == but case sensitive. Compares the 2 variables with EXACT match. So in this case if $a was MICHAEL and $b was Michael, it would return a false value

!= is not equal to
If $a is not equal to $b

< is greater than
Similar to the above, just that $a has to be MORE than $b and not equal to $b.

<= is greater than or equal to
$a is more or equal to $b, $a can be equal to $b.