Comparison Operators in Hindi
Comparison Operators में आठ प्रकार के Operators होते है |
Operators | Description |
---|---|
< | Less than |
> | Greater than |
<= | Less than or Equal to |
>= | Gretaer than or Equal to |
== | Equal to |
=== | Equal to |
!= | Not Equal to |
!== | Not Equal to |
Example for <(Less than)
Source Code :Output :12345678<?php
$a = 10;
$b = 6;
if($a < $b)
echo "a is less than b";
else
echo "a is not less than b";
?>
a is not less than b
Example for >(Greater than)
Source Code :Output :12345678<?php
$a = 10;
$b = 6;
if($a > $b)
echo "a is greater than b";
else
echo "a is not greater than b";
?>
a is greater than b
Example for <=(Less than or Equal to)
Source Code :Output :12345678<?php
$a = 10;
$b = 10;
if($a <= $b)
echo "a is less than or equal to b";
else
echo "a is not less than or equal to b";
?>
a is less than or equal to b
Example for >=(Greater than or Equal to)
Source Code :Output :12345678<?php
$a = 10;
$b = 5;
if($a >= $b)
echo "a is greater than or equal to b";
else
echo "a is not greater than or equal to b";
?>
a is greater than or equal to b
Difference between == and ===
Program में दो variables दिए हुए है उन दोनों का data type अलग-अलग है | उसमे से $a की value; integer है और $b की value double है |
== ये operator अपनी values को compare करता है |
=== ये operator अपनी values और उसके data types को compare करता है |
Source Code :Output :123456789101112131415<?php
$a = 5; //Integer
$b = 5.0; //Double
if($a == $b)
echo "a is equal to b <br />";
else
echo "a is not equal to b <br />";
if($a === $b)
echo "a is equal to b <br />";
else
echo "a is not equal to b <br />";
?>
a is equal to b
a is not equal to b
Difference between != and !==
Program पर दो variables है लेकिन उन दो variables की values same है पर data types अलग-अलग है |
!= ये operator अपनी values को compare करता है |
!== ये operator अपनी values और उसके data types को compare करता है |
Source Code :Output :123456789101112131415<?php
$a = 5; //Integer
$b = "5"; //String
if($a != $b)
echo "a is not equal to b <br />";
else
echo "a is equal to b <br />";
if($a !== $b)
echo "a is not equal to b <br />";
else
echo "a is equal to b <br />";
?>
a is equal to b
a is not equal to b
0 Comments