-
Notifications
You must be signed in to change notification settings - Fork 6
Zimo Xiao edited this page Mar 4, 2018
·
11 revisions
- mobile - check whether the user's agent is a computer or a mobile phone
- is::mobile()
-
- transform the user's agent string into lower letters then check if it contains 'mobile', 'android', or 'phone' to determine what agent the user is using
-
is::mobile();//true if user is using a phone
- empty - Check if anything is empty
- is::empty($input)
-
- accept an array or a string and return a boolean
- If the user inputs an array, function will check if $_FILES is empty or array as whole is empty or any array item is empty
- If the user inputs a string, function will check if the string is an empty string
-
is::empty($array_file_or_str); //true if []/['','']/''/0 or $_FILES['a_file'] does not exists
- return false if $in_p is not an array or a string
- ary - Judge if the input is an array
- is::ary($your_array)
-
-
is::ary($array);//true if $array is an array
-
- str - Judge if the input is a string
- is::str($str)
-
-
is::str($str);//true if $str is a string
-
- int - Judge if the input is an integer
- is::int($int)
-
-
is::int($int);//true if $int is an integer
-
- float - Judge if the input is a float
- is::float($float)
-
-
is::float($float);//true if $float is a float
-
- regex - check if the input matches a regular expression
- is::regex($input)
-
-
is::regex($input);//true if $input is a regular expression
- return true if the input matches a regular expression and return false otherwise
-
- in - Check if $part is a part of $full
- is::in($part, $full)
-
-
is::in($part,$full);//true if $part is a part of $full
- accept two parameters and return true if the first parameter is a part of the second parameter
- If $full is an array, function will loop over $full and check if $part is a part of a value in the array
- If $full is not an array and $part is a regular expression, function will check if $part and $full perform a regular expresssion match
- If $full is not an array and $part is not a regular expression, function will assume they are strings and check if $part is a substring of $full
-
- url - check if any url is in the input string and return the url if ther are any
- is::url($url)
-
-
is::url($url)//return the url if true and false if there's no valid url
-
- dir - check if the input string has an directory and return the directory if there are any
- is::dir($dir)
-
-
is::dir(string $dir)//true if directory exist
-
- email - check if the input string has an email and return the email if there are any
- is::email($email)
-
-
is::email($email); //if true, return the email, otherwise return false
-
- multi_layer - check if an array is multidimensional
- is::multi_layer($array)
-
-
is:: multi_layer([1,2,[3,4],5]); //if true array contains arrays
-