gettype-Get variable type
Grammar:
string gettype (mixed $var)
Possible values for the returned string are:
boolean
integer
double
string
array
object
resource
null
unknown type
Note:
Don't use gettype() to test a certain type, because the string it returns may change in future PHP versions, and it also runs slower because it involves string comparisons. It is recommended to use the is_ function instead.
If testing functions, function_exists() and method_exists() should be used.
is_ series functions:
is_array(): Checks whether the variable is an array.
is_double(), is_float(), is_real(): Check whether the variable is a floating point number.
is_long(), is_int(), is_integer(): Check whether the variable is an integer.
is_string(): Check whether the variable is a string.
is_bool(): Checks whether the variable is a Boolean value.
is_object(): Checks whether the variable is an object.
is_resource(): Checks whether the variable is a resource.
is_null(): Check whether the variable is null.
is_scalar(): Checks whether the variable is a scalar, i.e., an integer, boolean, string, or floating point number.
is_numeric(): Check if the variable is any type of number or numeric string.
is_callable(): Checks whether the variable is a valid function name.
settype-Set the type of variable
Grammar:
bool settype (mixed &$var,string $type)
Description:
Set the type of variable var to type.
|