Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

you. Consider this operation:


Click here to view code image
$a = $b + c;


In this operation, = and + are operators, and $a, $b, and $c are operands.
Along with +, you also already know − (subtract), * (multiply), and /
(divide), but Table 47.2 provides some more.


Table 47.2 PHP Operators


OperatorWhat    It  Does

= Assigns   the right   operand to  the left    operand.

== Returns  true    if  the left    operand is  equal   to  the right   operand.

!= Returns  true    if  the left    operand is  not equal   to  the right   operand.

=== Returns true    if  the left    operand is  identical   to  the right   operand.
This is not the same as ==.

!== Returns true    if  the left    operand is  not identical   to  the right
operand. This is not the same as !=.

< Returns   true    if  the left    operand is  smaller than    the right   operand.

> Returns   true    if  the left    operand is  greater than    the right   operand.

<= Returns  true    if  the left    operand is  equal   to  or  smaller than    the
right operand.

&& Returns  true    if  both    the left    operand and the right   operand are
true.

|| Returns  true    if  either  the left    operand or  the right   operand is  true.

++ Increments   the operand by  1.

— Decrements    the operand by  1.

+= Increments   the left    operand by  the right   operand.
Free download pdf