note 117924 added to function.define
| From: | rayschwartz at vassar dot edu | Date: | Wed, 02 Sep 2015 18:56:28 +0000 |
| Subject: | note 117924 added to function.define | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203577@lists.php.net to get a copy of this message | ||
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'
----
Server IP: 72.52.91.14
Probable Submitter: 143.229.168.46
----
Manual Page -- http://php.net/manual/en/function.define.php
Edit -- https://master.php.net/note/edit/117924
Del: integrated -- https://master.php.net/note/delete/117924/integrated
Del: useless -- https://master.php.net/note/delete/117924/useless
Del: bad code -- https://master.php.net/note/delete/117924/bad+code
Del: spam -- https://master.php.net/note/delete/117924/spam
Del: non-english -- https://master.php.net/note/delete/117924/non-english
Del: in docs -- https://master.php.net/note/delete/117924/in+docs
Del: other reasons-- https://master.php.net/note/delete/117924
Reject -- https://master.php.net/note/reject/117924
Search -- https://master.php.net/manage/user-notes.php