Reference to PHP Variable Handling Functions

PHP offers a wide range of built-in functions to manage and inspect variables effectively. These variable handling functions allow developers to examine, modify, and work with data stored in variables, similar to how PHP array functions provide tools for working with arrays. This guide compiles all the essential 30+ PHP variable handling functions, making it easier for you to understand and apply them in your projects.

Alphabetical Reference

The following table lists all 37 PHP variable handling functions, arranged in alphabetical order.

37 PHP Variable Handling Functions
Function Description
boolval() Returns the boolean equivalent of the given variable.
debug_zval_dump() Outputs the internal reference count and type of a variable.
doubleval() Converts a variable to its float (double) value.
empty() Checks whether a variable is empty or has no value.
floatval() Returns the floating-point value of a variable.
get_debug_type() Retrieves the variable type formatted for debugging purposes.
get_defined_vars() Returns an array of all variables currently defined in scope.
get_resource_id() Fetches the unique identifier for a given resource variable.
get_resource_type() Returns the resource type of a specified resource variable.
gettype() Returns the data type of the provided variable.
intval() Converts a variable to its integer value.
is_array() Determines if a variable is of the array type.
is_bool() Checks whether a variable is boolean true or false.
is_callable() Checks if a variable can be called as a function.
is_countable() Determines if a variable is countable (like arrays or Countable objects).
is_double() Checks if a variable is a float (double) type.
is_float() Returns true if the variable is of float type.
is_int() Checks if the variable is an integer type.
is_integer() Returns true if a variable is of integer type.
is_iterable() Checks whether a variable is iterable (like arrays or objects).
is_long() Determines if a variable is of integer (long) type.
is_null() Returns true if the variable is NULL.
is_numeric() Checks if a variable is a number or numeric string.
is_object() Determines if a variable is an object.
is_real() Checks if a variable is float or double type.
is_resource() Returns whether a variable is a resource type.
is_scalar() Checks if a variable is a scalar type (int, float, string, bool).
is_string() Determines if a variable is of string type.
isset() Checks if a variable is set and not NULL.
print_r() Outputs variable contents in a readable format.
serialize() Converts a variable into a storable serialized string.
settype() Changes the type of a variable to a specified type.
strval() Returns the string representation of a variable.
unserialize() Restores data from a serialized string back to its original form.
unset() Deletes a variable, removing its value and existence.
var_dump() Displays detailed information about one or more variables.
var_export() Outputs a parsable string representation of a variable.

Functions Availability

All PHP variable handling functions are included by default with the language, requiring no additional installation or setup, except for minimal configuration in rare cases like the unserialize function. This makes them readily available for immediate use.