# PHP Operators ,Operands & Expression

PHP Operators , Operands and Expression  are sets of characters which  perform a special task in the PHP code.

For example : An assignment operator  the equals sign ( `=` ) is use to assign a value to a variable.which is known as assignment operator.

We use a plus sign ( `+` ) to  add two number together and   it is known as an arithmetic operator.

## Operands:

Operator can’t  do any things without operand and operand is that on which an operator work. For example: 5 + 3 = 8  Here, 5 and 3 are operand & plus sign(+) , equal sign(=) are operators and 5+3=8 is an expression .

Dear learner in this tutorial  i discussed details about PHP Operators, operand and  Expression .  I Hope everybody must be benefited  form this tutorial.

## 1. Arithmetic Operators:

List of  Arithmetic operators in PHP:

 Operator with expression Name Description Example Result a+ b Addition Sum of a and b 5+3 8 a-b Subtraction Difference of a & b 6-4 2 a*b Multiplication Product of a and b 8*8 64 a/b Division Quotient of a and b 25/5 5 a%b Modules/mod Remainder of a divided by b 7%3 1 -a Negation Opposite of a -5 -5 x . y Concatenation Concatenate of two string “Hell” . “World “ Helloworld

## 2. Decrementing/Incrementing Operators in PHP:

 Operator with expression Name Description ++a Pre-increment Increment a by one, then returns a. a++ Post-increment Return a, then increment a by one –a Pre-decrement Decrements a by one, then return a. a– post-decrement Return a then decrements a by one.

## 3. Assignment Operators:

An assignment operator  the equals sign ( `=` ) is use to assign a value to a variable.which is known as assignment operator.

For example:

 Assignment Operators with expression Description a=a Here left operand get the value of the expression on the right side a+=b Or a=a+b Addition a-=b Or a=a-b Subtraction a*=b Or a=a*b Multiplication a /=b Or a= a /b Division a%=b Or a= a%b Modulus/mod x.=y Or a=a .b Concatenate two strings

## 4. Logical Operators in PHP:

List of  logical Operators in PHP:

 Operator Name Description Example a and b And True if both a and b are true. a=5,b=2(a<8 and b>1 )thenreturn true. a or b Or True if one  or both a & b are true a=7,b=9if (a==7 or b==6)then return true. a xor b Xor True if one Or   a or b is true but not both. a=3,b=5If(a==3 xor b=5)return false.Becauseboth are true. a && b Logical And True if both a and b are true. a=8,b=4if (a<9 && B>3)then return true. a || b Logical Or True if one  or both a & b are true. a=2,b=9if( a==2 || b==9)then return true ! a Not True if a is not true a=10,b=12if !(a==b) then returntrue.