diff options
Diffstat (limited to 'lib/general.lib.php')
-rw-r--r-- | lib/general.lib.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/general.lib.php b/lib/general.lib.php index 3dbe6d23..aa8f27a9 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -809,4 +809,26 @@ function scrub_out($str) { } // scrub_out +/** + * make_bool + * This takes a value and returns what I consider to be the correct boolean value + * This is used instead of settype alone because settype considers 0 and "false" to + * be true + * @package General + */ +function make_bool($string) { + + if (strcasecmp($string,'false') == 0) { + return '0'; + } + + if ($string == '0') { + return '0'; + } + + return settype($string,"bool"); + +} // make_bool + + ?> |