What does the double not operator do in PHP?
For example:
return !! $row;
What would the code above do?
Lets look at
!$a;
Rather than interpreting the ! operator as as taking the
Boolean opposite of the value to its right
read
take the Boolean opposite of the expression to its right
In this case
$a;
could be an expression
so to is
!$a;
so is
!!$a;
and
!!!$a;
and so on, as each of these is a valid expression, the ! operator can be prepended to each of them.