Have you been given a piece of code to maintain that has single, double and triple equal operators in it? What’s the difference?
Single Equals
A single equal sign in PHP is an assignment operator. It assigns the value of the right side to the variable on the left side.
For example:
echo $name; //output is “jon”
Double Equals
Two equal signs in PHP is a comparison operator used to check if the value on the left is the same as the value on the right. This is what you normally use in If statements.
For example:
$b = 4+1;
// then $a == $b is true
Triple Equals
Three equal signs in PHP is also a comparison operator but looks not only at the value but also looks at the type of the variables.
For example:
$age2 = 5;
// then $age1 == $age2 is true
// and $age1 === $age2 is false because the variables are of different types