note 55860 added to language.types.boolean

From: Date: Mon, 15 Aug 2005 21:17:53 +0000
Subject: note 55860 added to language.types.boolean
Groups: php.notes 
Request: Send a blank email to php-notes+get-93700@lists.php.net to get a copy of this message
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 ) ; } } ---- Manual Page -- http://www.php.net/manual/en/language.types.boolean.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55860 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55860&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55860&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55860&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55860&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55860&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55860&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55860&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93700) next »