Variable Manipulation Functions

The following functions operate on PHP variables. There are functions for getting and setting the type of a variable, as well as various ways to encode and decode variables for storage.

bool define(string var_name, mixed value[, int case_sensitive])

Define a constant value

int defined(string constant_name)

Test if a constant is defined

double doubleval(mixed var)

Get the double-precision value of a variable

string getenv(string varname)

Get the value of an environment variable

string gettype(mixed var)

Return the type of the variable

int intval(mixed var [, int base])

Get the integer value of a variable using the optional base for the conversion

bool is_array(mixed var)

Return true if variable is an array

bool is_double(mixed var)

Return true if variable is a double

bool is_float(mixed var)

An alias for is_double( )

bool is_int(mixed var)

An alias for is_long( )

bool is_integer(mixed var)

An alias for is_long( )

bool is_long(mixed var)

Return true if variable is a long (integer)

bool is_object(mixed var)

Return true if variable is an object

bool is_real(mixed var)

An alias for is_double( )

bool is_string(mixed var)

Return true if variable is a string

string pack(string format, mixed arg1, mixed arg2, ...)

Take one or more arguments and pack them into a binary string according to the format argument

bool is_real(mixed var)

An alias for is_double( )

bool is_string(mixed var)

Return true if variable is a string

void putenv(string setting)

Set the value of an environment variable

string ...

Get PHP Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.