PHP and Keyword

❮ PHP Keywords

Example

Return true if both statements are true:

<?php
if (5 > 3 and 5 < 10) {
  echo "true";
} else {
  echo "false";
}
?>
Try it Yourself »

Definition and Usage

The and keyword is a logical operator.

Logical operators are used to combine conditional statements.

The return value will only be true if both statements return true, otherwise it will return false.

Tip: The difference between and and && is that and has very low precedence, meaning that most other operations get evaluated first.


Related Pages

Read more about operators in our PHP Operators Tutorial.


❮ PHP Keywords
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.