mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Fix toBool() and add more test cases
This commit is contained in:
parent
f73580945d
commit
8147044802
2 changed files with 10 additions and 2 deletions
|
|
@ -508,8 +508,8 @@ function tobool($input)
|
|||
{
|
||||
if (is_scalar($input))
|
||||
{
|
||||
if (preg_match('/^(1|[ty].*|on|ok.*oui|si|vrai|aye)$/i', $input)) return true;
|
||||
if (preg_match('/^(0|[fn].*|off)$/i', $input)) return false;
|
||||
if (preg_match('/^(?:1|[ty].*|on|ok.*|oui|si|vrai|aye)$/i', $input)) return true;
|
||||
if (preg_match('/^(?:0|[fn].*|off|out)$/i', $input)) return false;
|
||||
}
|
||||
return (bool)$input;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue