PHP Operators

3:Logical Operators

We Will Discuss following logical operators that are link by PHP language

Assume variable One holds 5 and variable Two holds 10 then...

Some of the following Examples of Logical Operators are here....


  • " And " (it's Called Logical AND operator. If both the operands are true then condition becomes true.)                                    (A and B) is true.
  • " Or " (it's Called Logical OR Operator. If any of the two operands are non-zero then condition becomes true.)                     (A or B) is true.
  • " && " (it's Called Logical AND operator. If both the operands are non-zero then condition becomes true.)                                      (A && B) is true.
  • " || " (it's Called Logical OR Operator. If any of the two operands are non-zero then condition becomes true.)                                       (A || B) is true.
  • " ! " (it's Called Logical NOT Operator. It will Use to reverses logical state of its operand. If the condition will be true then Logical NOT operator will make false.)                                                                       !(A && B) is false.



4:Assignment Operators

We Will Discuss following logical operators that are link by PHP language....

Some of the following Examples of Assignment Operators are ... 

  • " = " (Simple assignment operator, Assigns values from right side operands to left side operand.)                                                                                                                                                                C = A + B will assign value of A + B into C
  • " += " (Add AND assignment operator, It adds right operand to left operand ALSO to assign the result to the left operand.)                                                                                                                                 C += A is equivalent to C = C + A
  • " -= " (Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand.)                                                                                                                         C -= A is equivalent to C = C - A
  • " *= " (Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand.)                                                                                                                        C *= A is equivalent to C = C * A
  • " /= " (Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand.)                                                                                                                                C /= A is equivalent to C = C / A
  • " %= " (Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand.)                                                                                                                                C %= A is equivalent to C = C % A

5:Conditional Operator

There's one greater operator known as a conditional operator. This first evaluates an expression for a real or fake price and then execute one of the  given statements depending upon the result of the assessment. The conditional operator has this syntax..

Some of the following Examples of Conditional Operators are ... 

  • " ?: "           (Conditional Expression)                                                                                              If Condition will be true ? Then value will be X : Otherwise value Y

Comments

Popular posts from this blog

Advance PHP Tutorials

Operator Types - PHP