CKTIS / PHP
Logical negation (!)
Negation converts its operand to a boolean and reverses it.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
!$expressionNegation converts its operand to a boolean and reverses it. Exactly two strings convert to false, "" and "0". The strings "00", "10" and "A0" convert to true. An empty array is false-like, but an array containing zero is nonempty and truthy.
!$expression
[true,false,true,false]
Examples
<?php
echo json_encode([!'0', !'00', ![], ![0]]);
Result
[true,false,true,false]