diff --git a/src/MD_STD_IN.php b/src/MD_STD_IN.php index 43556d1..0adfe86 100644 --- a/src/MD_STD_IN.php +++ b/src/MD_STD_IN.php @@ -131,6 +131,20 @@ final class MD_STD_IN { } + /** + * Converts an input value into a bool. Different from the default PHP way, + * the strings "false" and "False" are treated as negative. + * + * @param mixed $inputs Input data. + * + * @return boolean + */ + public static function boolval(mixed $inputs):bool { + + if (is_string($inputs) && (strtolower($inputs) === "false")) return false; + return (bool)$inputs; + } + /** * Validates an input array for all entries being strings. Unsets empty values. * This is especially useful for parsed JSON.