PHP » PYTHON |
login |
register |
about
|
True False bool # the boolean type note that in Python, boolean is a subclass of integer. So True can be used as the integer 1, and False as 0 BooleansThis is the simplest type. A boolean expresses a truth value. It can be either TRUE or FALSE.
SyntaxTo specify a boolean literal, use the keywords TRUE or FALSE. Both are case-insensitive.
<?php Typically, some kind of operator which returns a boolean value, and the value is passed on to a control structure.
<?php Converting to booleanTo explicitly convert a value to boolean, use the (bool) or (boolean) casts. However, in most cases the cast is unncecessary, since a value will be automatically converted if an operator, function or control structure requires a boolean argument. See also Type Juggling. When converting to boolean, the following values are considered FALSE:
Every other value is considered TRUE (including any resource). Warning
-1 is considered TRUE, like any other non-zero (whether negative or positive) number!
<?php |
more
Recently updated
more
Most requested
more
Last requests
|