aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dblayer/functions_mysql.inc.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/include/dblayer/functions_mysql.inc.php b/include/dblayer/functions_mysql.inc.php
index 785e588e0..9230af473 100644
--- a/include/dblayer/functions_mysql.inc.php
+++ b/include/dblayer/functions_mysql.inc.php
@@ -634,17 +634,20 @@ function get_enums($table, $field)
return $options;
}
-// get_boolean transforms a string to a boolean value. If the string is
-// "false" (case insensitive), then the boolean value false is returned. In
-// any other case, true is returned.
-function get_boolean( $string )
+/**
+ * Smartly checks if a variable is equivalent to true or false
+ *
+ * @param mixed input
+ * @return bool
+ */
+function get_boolean($input)
{
- $boolean = true;
- if ( 'false' == strtolower($string) )
+ if ('false' === strtolower($input))
{
- $boolean = false;
+ return false;
}
- return $boolean;
+
+ return (bool)$input;
}
/**