Warning: include() [function.include]: open_basedir restriction in effect. File(/home/toknowmo/public_html/configs.php) is not within the allowed path(s): (/home/migrate.a2/web:/home/ezee4040:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/ezee4040/public_html/toknowmore.net/e/1/php/how-to-use-comparison-operators-in-php.php on line 2

Warning: include(/home/toknowmo/public_html/configs.php) [function.include]: failed to open stream: Operation not permitted in /home/ezee4040/public_html/toknowmore.net/e/1/php/how-to-use-comparison-operators-in-php.php on line 2

Warning: include() [function.include]: Failed opening '/home/toknowmo/public_html/configs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ezee4040/public_html/toknowmore.net/e/1/php/how-to-use-comparison-operators-in-php.php on line 2
What Are Comparison Operators And How To Use Them In PHP

HOW TO USE COMPARISON OPERATORS IN PHP

PHP provides you with many comparison operators that you can use to compare values against each other. The most popular ones are: ==, >, <, >=, <=, != and are explained further below.

==

Use to test whether two values are equal in value.

Example:

if($name=='John')
{
echo "Welcome"; // any action statement/s
}

>

Use to test whether the left hand side value is greater in value than the right hand side value.

Example:

if($count > 10)
{
echo "Welcome"; // any action statement/s
}

<

Use to test whether the left hand side value is smaller in value than the right hand side value.

Example:

if($count < 10)
{
echo "Welcome"; // any action statement/s
}

>=

Use to test whether the left hand side value is greater than or equal to in value than the right hand side value.

Example:

if($count >= 10)
{
echo "Welcome"; // any action statement/s
}

<=

Use to test whether the left hand side value is smaller than or equal to in value than the right hand side value.

Example:

if($count <= 10)
{
echo "Welcome"; // any action statement/s
}

!=

Use to test whether the left hand side value is not equal to in value than the right hand side value.

Example:

if($count != 10)
{
echo "Welcome"; // any action statement/s
}