note 117924 deleted from function.define by cmb
| From: | cmb@php.net | Date: | Wed, 02 Sep 2015 19:25:05 +0000 |
| Subject: | note 117924 deleted from function.define by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203578@lists.php.net to get a copy of this message | ||
Note Submitter: rayschwartz at vassar dot edu
----
If you negate a boolean named constant, you get the opposite boolean in return which can be useful
for conditional statements.
A named constant can only have scalar values: boolean, float, integer, string or null.
In the cases of float, integer, and string, negating a named constant always returns false.
In the case of null, negating a named constant always returns true.
If the named constant has a boolean value, negating it returns the opposite boolean.
<?php
define (âCNST_FALSE', false);
define (âCNST_TRUE', true);
if(!CNST_FALSE)
{
echo âTâ;
}
else{
echo âFâ;
}
output: âT'
if(!CNST_TRUE)
{
echo âFâ;
}
else{
echo âTâ;
}
output: âF'