Or operator in assignment left side

I've seen the next sentence in PHP code:

$a OR $a = $b;

What is the behavior of this code?

or

What is the purpose of this code?

Thanks,

Upvotes: 2

Views: 117

Answers (1)

Jefersonfs
Jefersonfs

Reputation: 42

The operator "OR" is a Logical operator, used to check if one of two (or more) terms is true. if either $a or ($a = $b) is TRUE. The operator "==" (in your question is =, but i think is == ) is a Comparison operator, used to check if $a is equal to $b (like same value, term A is true and term B is true, others cases). Thanks

Upvotes: 1

Related Questions