PHP Operators

php-operators

PHP Operator is a symbol that tells the PHP processor to do certain actions. There are several operators used in PHP language, so we have separated them into the following categories to create it easier to learn them all.

In PHP have following operators, please see below point wise:

a) Arithmatic Operators

b) Assignment Operators

c) Comparison Operators

d) Increment/Decrement Operators

e) Logical Operators

f) String Operators

g) Array Operators


A) ARITHMATIC OPERATORS

PHP arithmetic operators used for numeric values to perform arithmetical operations, like addition, subtraction, multiplication, division, modulus etc.

Like :        $a + $b,      $a – $b,       $a * $b,       $a / $b,       $a % $b


B) ASSIGNMENT OPERATORS

Assignment operator in PHP is “=”. It means the left operand gets set the value of the assignment expression on the right.

Like :

A = B + C will assign value of B + C into A
A += B is equivalent to A = A + B(Addition)
A -= B same as A = A – B(Subtraction)
A *= B same as A = A * B(Multiplication)
A /= B same as A = A / B(Division)
A %= B same as A = A % B(Modulus)


C) COMPARISON OPERATORS

PHP comparison are compare to two values !!

OperatorName of OperatorExample
==Equal$a == $b
!=Not equal$a != $b
<>Not equal$a <> $b
>Greater than$a > $b
<Less than$a < $b
>=Greater than or equal to$a >= $b
<=Less than or equal to$a <= $b

Coding Tag

Coding Tag always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

avatar
  Subscribe  
Notify of