It's not the "double not operator", it's the not operator applied twice. The right !
will result in a boolean, regardless of the operand. Then the left !
will negate that boolean.
This means that for any true value (numbers other than zero, non-empty strings and arrays, etc.) you will get the boolean value TRUE
, and for any false value (0, 0.0, NULL
, empty strings or empty arrays) you will get the boolean value FALSE
.
It is functionally equivalent to a cast to boolean
:
return (bool)$row;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…