PHP contains three types of operators: unary operators, binary operators, and one ternary operator.
Binary operators are used on two operands:
2 + 3 14 * 3.1415 $i – 1
These examples are also simple examples of expressions.
PHP can only perform binary operations on two operands that have the same type. However, if the two operands have different types, PHP automatically converts one of them to the other's type, according to the following rules (unless stated differently, such as in the concatenation operator).
|Type of One of the Operands||Type of the Other Operand||Conversion Performed|
|Integer||Floating point||The integer operand is converted to a floating point number.|
|Integer||String||The string is converted to a number. If the converted ...|