Getting started
Variables
Arrays
Functional programming
Types
Autoloading primer
Exception handling and error reporting
Working with dates and time
Sending email
Sessions
Cookies
Classes and objects
Password hashing
Output buffering
JSON
SOAP
Reflection
cURL
Dependency injection
XML
Regular expressions
Traits
Namespaces
Parsing HTML
Composer dependency manager
Magic methods
Alternative syntax for control structures
File handling
Magic constants
Type hinting
Multi-threading extension
Filters, filter functions
Generators
Operators
Operators
Null Coalescing Operator
Spaceship Operator
Execution Operator
Incrementing and Decrementing Operators --
Ternary Operator
Logical Operators AND and OR
String Operators . and .
Object and Class Operators
Combined Assignment etc
Altering operator precedence with parentheses
Association
Basic Assignment
Comparison Operators
Bitwise Operators
instanceof type operator
Constants
UTF-8
URLs
Object serialization
PHPDoc
Contributing to PHP Manual
String parsing
Loops
Control structures
Serialization
Closur
Reading request data
Type juggling and non-strict comparison issues
Security
PHP MySQLi
Command Line Interface CLI
Localization
Debugging
Superglobal variables
Unit testing
Variable scope
References
Compilation errors and warning
Installing PHP on Windows
DateTime class
Headers manipulation
Performance
Common Errors
Installing on Linux / Unix
Contributing to PHP Core
Coding conventions
Using MongoDB
Asynchronous programming
Using SQLSRV
Unicode Support
Functions
Create PDF files
Hot to detect client IP address
YAML
Image processing with GD
Multiprocessing
SOAP Server
Machine learning
Cache
Streams
Array iteration
Cryptography
PDO
SQLite3
Sockets
Outputting the value of a variable
String formatting
Compile PHP extensions
MongoDB
Manipulating an array
Executing upon an array
Processing multiple arrays together
SPL data structures
Comments
IMAP
Redis
Imagick
SimplXML
HTTP Authentication
Recipies
BC Math Binary Calculator
Docker deployment
WebSockets
APCu
Design patterns
Secure remember me
PHP mysqli
PHP built-in server
How to break down an URL
PSR
Contributors

Logical Operators AND and OR

suggest change

In PHP, there are two versions of logical AND and OR operators.

Operator | True if ———– | ––––––– $a and $b | Both $a and $b are true $a && $b | Both $a and $b are true $a or $b | Either $a or $b is true $a || $b | Either `$aor$b` is true

Note that the && and || opererators have higher precedence than and and or. See table below:

Evaluation | Result of $e | Evaluated as ——————— | ——————— | ———— $e = false || true | True | $e = (false || true) `$e = false or true| False |($e = false) or true`

Because of this it’s safer to use && and || instead of and and or.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents
15 JSON
16 SOAP
18 cURL
20 XML
22 Traits
36 UTF-8
37 URLs
39 PHPDoc
42 Loops
45 Closur
73 YAML
78 Cache
82 PDO
94 IMAP
95 Redis
103 APCu
109 PSR