PHP Function Reference

PHP - Variable Handling



The PHP has a number of functions to deal with variable handling.

Installation

There is no installation needed to use these functions. These functions are part of the PHP core.

PHP Variable Handling Functions

FunctionsDescription
boolval() Get the boolean value of a variable.
doubleval() Get float value of a variable. Alias of floatval() function.
empty() Checks whether a variable is empty.
floatval() Get float value of a variable.
get_debug_type() Gets the type name of a variable in a way that is suitable for debugging.
get_defined_vars() Returns an array of all defined variables.
get_resource_id() Returns an integer identifier for the given resource.
get_resource_type() Returns the resource type.
gettype() Get the type of a variable.
intval() Get the integer value of a variable.
is_array() Checks whether a variable is an array.
is_bool() Checks whether a variable is a boolean.
is_countable() Checks whether the contents of a variable is a countable value.
is_double() Checks whether a variable is of type float. Alias of is_float() function.
is_float() Checks whether a variable is of type float.
is_int() Checks whether a variable is of type integer.
is_integer() Checks whether a variable is of type integer. Alias of is_int() function.
is_iterable() Checks whether the contents of a variable is an iterable value.
is_long() Checks whether a variable is of type integer. Alias of is_int() function.
is_null() Checks whether a variable is null.
is_numeric() Checks whether a variable is a number or a numeric string.
is_object() Checks whether a variable is an object.
is_real() Checks whether a variable is of type float. Alias of is_float() function.
is_resource() Checks whether a variable is a resource.
is_scalar() Checks whether a variable is a scalar.
is_string() Checks whether a variable is of type string.
print_r() Prints the information about a variable in a more human-readable way.
settype() Set the type of a variable.
unset() Unset a given variable.
var_dump() Dumps information about one or more variables.
var_export() Outputs or returns a parsable string representation of a variable.

5