note 55860 deleted from language.types.boolean by victor
| From: | victor@php.net | Date: | Tue, 16 Aug 2005 08:08:14 +0000 |
| Subject: | note 55860 deleted from language.types.boolean by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93716@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at tmproductionz dot com
----
i wanted a quick function that returns an int if the booleon was true and 0 for false because it
defeated the purpose if it returned true or false; This functions will also convert the given
argument to a booleon if it is not one.
function is_true ( $bool ) {
if ( is_bool ( $bool ) ) {
if ( $bool === TRUE ) return 1;
else return 0;
} else {
$bool = settype ( $bool , 'boolean' ) ;
return is_true ( $bool ) ;
}
}