PHP Comparison Operators

PHP Assignment Operators Previous Next PHP Logical Operators


#
Operator
Operator Name
Example
Description
1
>
is greater than
a > b
a is greater than b
2
<
is less than
a < b
a is less than b
3
>=
is greater than or equal to
a >= b
a is greater than or equal to b
4
<=
is less than or equal to
a <= b
a is less than or equal to b
5
==
is equal to
a == b
a is equal to b
6
!=
is not equal to
a != b
a is not equal to b

Filename: php / comparision1.php


Code
<?php
//comparision1
$a = 19;
$b = 62;
var_dump($a > $b); 
?>

Running Step.


Type Url - https://localhost/php/comparision1.php

Filename: php / comparision2.php


Code
<?php
//comparision2
$a = 86;
$b = 39;
var_dump($a < $b); 
?>

Running Step.


Type Url - https://localhost/php/comparision2.php

Filename: php / comparision3.php


Code
<?php
//comparision3
$a = 75;
$b = 84;
var_dump($a >= $b); 
?>

Running Step.


Type Url - https://localhost/php/comparision3.php

Filename: php / comparision4.php


Code
<?php
//comparision4
$a = 63;
$b = 63;
var_dump($a <= $b); 
?>

Running Step.


Type Url - https://localhost/php/comparision4.php

Filename: php / comparision5.php


Code
<?php
//comparision5
$a = 98;
$b = 37;
var_dump($a == $b); 
?>

Running Step.


Type Url - https://localhost/php/comparision5.php

Filename: php / comparision6.php


Code
<?php
//comparision6
$a = 73;
$b = 96;
var_dump($a != $b); 
?>

Running Step.


Type Url - https://localhost/php/comparision6.php


Tags: PHP


Was this helpful ?


Popular Code

Latest Code