Archive for March, 2009
array_key_exists()
Returns true if the given key exists in the array. isset() will return the same result in most cases.
array_search()
Returns the first key corresponding to a given value in an array. Returns false if not found. Set the third parameter to true to be strict and also check the type.
in_array()
Checks the array for a given value and returns true if it is found. Only checks one level deep (does not look into the nested arrays). Set the third parameter to true to be strict and also check the type.
is_bool()
Returns true if the given variable holds a boolean value. Returns false otherwise.
isset()
Returns true or false whether a variable is considered to be set or not. A variable with a value of NULL is not considered to be set. If you feed it multiple variables, it will return true only if all of them are set.
empty()
Returns true or false whether a variable is considered to be empty. Be careful when using this function that you remember what values are considered “empty”.
settype()
Sets the type of a given variable. Allowed types are: bool, boolean, int, integer, float, string, array, object, resource, null.
gettype()
Returns the type of the given variable. The return value will be one of: boolean, integer, double, string, array, object, resource, NULL, unknown type.
pow()
Pass in a base number and an exponent and this function calculates that base raised to the power of the exponent.
sqrt()
Returns the square root of a number (float). If a negative number is passed, it returns the special value NAN (Not A Number).
