A practical example for better understanding:
<?php
$variavel = 'true';
if($variavel == "true"){
echo "1";
}
if($variavel == true){
echo "2";
}
if($variavel === true){
echo "3";
}
if($variavel = true){
echo "4";
}
echo $variavel;
The values that will be displayed on screen: 1, 2, 4 and 1
($ variable == true) = True because it is the same string. ($ variable == true) = True because true is equal to true. ($ variable === true) = False because true is true, but the types are different, one is a string and the other is Boolean. ($ variable = true) = true since it is a simple value assignment, this case will only be false if the assignment fails, usually the false return happens when the value for comparison comes from a function, the function can return something that is impossible to assign.
And the value 1 of the end is the result of the "$ variable" since after ($ variable = true) its value has changed to true because of the assignment and when it shows on the screen it shows 1 that is true for php, if you do so 'echo true;' the result on the screen will be 1 as well.