- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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)
- 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
- Difference between Python and PHP.
- Difference Between PHP and Python
- Difference between == and is operator in python.
- Difference between concat() and + operator in Java
- Explain difference between == and is operator in Python.
- Difference between bindParam and bindValue in PHP
- Difference Between For and Foreach in PHP