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.

Runtime Configuration

The behavior of these functions is affected by settings in php.ini.

Variables Configuration Options

NameDefaultDescriptionChangeable
unserialize_callback_funcnullThe callback specified is called when unserialize() attempts to use an undefined class. A warning appears if the specified callback function is not defined, or if the callback function fails to define the missing class.PHP_INI_ALL

PHP Variable Handling Functions

FunctionsDescription
boolval() Get the boolean value of a variable.
debug_zval_dump() Dumps a string representation of an internal zval structure to output.
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_callable() Checks whether a variable can be called as a function from the current scope.
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.
isset() Checks whether a variable is declared and is different than null.
print_r() Prints the information about a variable in a more human-readable way.
serialize() Generates a storable representation of a value.
settype() Set the type of a variable.
strval() Get string value of a variable.
unserialize() Creates a PHP value from a stored representation.
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.

PHP Variable Handling Predefined Constants

This extension has no constants defined.