Page 1 :
PHP Operators, Operators are used to perform operations on variables and values., PHP divides the operators in the following groups:, Arithmetic operators, Assignment operators, Comparison operators, Increment/Decrement operators, Logical operators, String operators, Array operators, Conditional assignment operators, , , , , , , , , , , , Arithmetic Operators, There are following arithmetic operators supported by PHP language −, Assume variable A holds 10 and variable B holds 20 then:, Operator, , Description, , Example, , +, , Adds two operands, , A + B will give 30, , -, , Subtracts second operand from the first, , A - B will give -10, , *, , Multiply both operands, , A * B will give 200, , /, , Divide numerator by de-numerator, , B / A will give 2, , %, , Modulus Operator and remainder of after an integer, division, , B % A will give 0, , ++, , Increment operator, increases integer value by one, , A++ will give 11, , --, , Decrement operator, decreases integer value by, one, , A-- will give 9
Page 2 :
Comparison Operators, There are following comparison operators supported by PHP language, Assume variable A holds 10 and variable B holds 20 then :, Operator, , Description, , Example, , ==, , Checks if the value of two operands are equal or not, if, yes then condition becomes true., , (A == B) is not true., , !=, , Checks if the value of two operands are equal or not, if, values are not equal then condition becomes true., , (A != B) is true., , >, , Checks if the value of left operand is greater than the, value of right operand, if yes then condition becomes, true., , (A > B) is not true., , <, , Checks if the value of left operand is less than the, value of right operand, if yes then condition becomes, true., , (A < B) is true., , >=, , Checks if the value of left operand is greater than or, equal to the value of right operand, if yes then, condition becomes true., , (A >= B) is not true., , <=, , Checks if the value of left operand is less than or equal, to the value of right operand, if yes then condition, becomes true., , (A <= B) is true.
Page 3 :
Logical Operators, There are following logical operators supported by PHP language, Assume variable A holds 10 and variable B holds 20 then −, Show Examples, Operator, , Description, , Example, , and, , Called Logical AND operator. If both the operands are, true then condition becomes true., , (A and B) is true., , or, , Called Logical OR Operator. If any of the two operands, are non zero then condition becomes true., , (A or B) is true., , &&, , Called Logical AND operator. If both the operands are, non zero then condition becomes true., , (A && B) is true., , ||, , Called Logical OR Operator. If any of the two operands, are non zero then condition becomes true., , (A || B) is true., , !, , Called Logical NOT Operator. Use to reverses the, logical state of its operand. If a condition is true then, Logical NOT operator will make false., , !(A && B) is false.
Page 4 :
Assignment Operators, There are following assignment operators supported by PHP language −, Show Examples, Operator, , Description, , Example, , =, , 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 the left operand and assign the, result to 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, , %=