Binary Operator¶
A binary operator is an operator that operates on a two operands. It performs an operation based on the value of both operand. PHP supports several binary operators, including the following:
Assignation operator
=Equality operator
==Difference operator
!-and<>Identity operator
===Non-identity operator
!==Math operators, such as addition
+, substraction-, multiplication*, division/, power**, modulo%Comparison operators, such as greater than
>, greater or equal than>=, lesser than<, lesser or equal than<=Concatenation, with the dot operator
.Spaceship operator,
<=>All the short operators, that combines a binary operation with an assignation: for example, add and assign
+=
And many others.
<?php
$a = 1;
$a +=2;
var_dump($a === 3); // true
?>
Related : Unary Operator, Ternary Operator, Binary