You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One can probably argue, then why don't you just make the array $list all lowercase, and then
you can just do a strtolower call, before doing the in_array check.
we'll if that's the case, then we can atleast have a strtolower on the $check string, with the ignore case option.
Just a thought!
The text was updated successfully, but these errors were encountered:
Created by Dmitri De Klerk, 17th Sep 2013. (originally Lighthouse ticket #3521):
I dono if this is the place to post this,
This is more of an enhancement than a bug or issue.
Validation::inList(string $check, array $list);
The above function will be awesome if it had another optional parameter, ignorecase
e.g.
/**
*
@param
string $check Value to check@param
array $list List to check against@param
boolean $strict Defaults to true, set to false to disable strict type check@param
boolean $ignorecase Defaults to false, set to true to enable ignore case check@return
boolean Success*/
public static function inList($check, $list, $strict = true, $ignorecase = false) {
if ( $ignorecase ) {
return in_array($check, $list, $strict);
} else {
return in_array(strtolower($check), array_map('strtolower', $list), $strict);
}
}
One can probably argue, then why don't you just make the array $list all lowercase, and then
you can just do a strtolower call, before doing the in_array check.
we'll if that's the case, then we can atleast have a strtolower on the $check string, with the ignore case option.
Just a thought!
The text was updated successfully, but these errors were encountered: