- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
Difference between the AND and && operator in php
'AND' Logical operator
'AND' operator is a logical AND operator but has low precedence to = operator.
'&&' Logical operator
'&&' is also a logical AND operator but has high precedence to = operator.
Following the example, shows the difference of 'AND' vs '&&' operators.
<!DOCTYPE html> <html> <head> <title>PHP Example</title> </head> <body> <?php $x = true; $y = false; $result = $x AND $y; print('$result = $x AND $y'); print("<br/>"); var_dump($result); print("<br/>"); $result = $x && $y; print('$result = $x && $y'); print("<br/>"); var_dump($result); ?> </body> </html>
$result = $x AND $y bool(true) $result = $x && $y bool(false)
- Related Articles
- Difference between the and$ operator in php
- Difference between !== and ==! operator in PHP
- Difference between the | and || or operator in php
- Difference between the Ternary operator and Null coalescing operator in php
- Comparison between "&&" and "AND" operator in PHP.
- Difference between "new operator" and "operator new" in C++?
- Difference between concat() and + operator in Java
- Difference between == and is operator in python.
- Difference between Python and PHP.
- Difference Between PHP and Python
- Difference between PHP and C
- Explain difference between == and is operator in Python.