== Operator
"==" operator is used for comparing two values or variables and return true if they are same.
<?php $a=5; if ($a==5) echo "Five"; //Outputs Five ?>!= and <> Operator
"!=" and "<>" operators are also used for comparing two values or variables but they return true if the values are not same.
<?php $a=5; if ($a!=4) echo "Four"; //Outputs Four if ($a<>4) echo "Four"; //Outputs Four ?>> Operator
">" operator is used to check whether the first value is greater than second or not.
<?php $a=5; if ($a>4) echo "Greater"; //Outputs Greater ?>< Operator
"<" operator is used to check whether the first value is less than second or not.
<?php $a=5; if ($a<6) echo "Lesser"; //Outputs Lesser ?>>= Operator
">=" operator is used to check whether the first value is greater than or equal to the second value or not.
<?php $a=5; if ($a>=5) echo "Greater"; //Outputs Greater if ($a>=4) echo "Greater"; //Outputs Greater ?><= Operator
"<=" operator is used to check whether the first value is less than or equal to the second value or not.
<?php $a=5; if ($a<=5) echo "Lesser"; //Outputs Lesser if ($a<=6) echo "Lesser"; //Outputs Lesser ?>
Ok Guyz, that is all for this lesson, feel free to comment and ask any quries that you may have.
Previous Lesson --- Next Lesson
No comments:
Post a Comment