And Operator (&&)
"&&" operator is used to take the union of two or more conditions and returns true if and only if all the conditions are true.
<?php $a=5; $b=6; if ($a==5 && $b==6) echo "true"; //Outputs true ?>Or Operator (||)
"||" operator returns true if any of the condition is true.
<?php $a=5; $b=6; if ($a==5 || $b==5) echo "true"; //Outputs true ?>Not Operator (!)
"!" operator returns true when no condition is true.
<?php $a=5; $b=6; if !($a==$b) echo "true"; //Outputs true ?>Well that is all we need to know about Operators in php, keep reading and feel free to ask questions through comments.
Previous Lesson --- Next Lesson
No comments:
Post a Comment