Variable functions

Variable functions

gettype

Name

gettype — Get the type of a variable.

Description

intval

string gettype(mixed var);

Returns the type of the PHP variable var. Possibles values for the returned string are:

  • "integer"

  • "double"

  • "string"

  • "array"

  • "object"

  • "unknown type" See also settype.

Name

intval — Get integer value of a variable.

Description

int intval(mixed var, int [base]);

Returns the integer value of var, using the specified base for the conversion (the default is base 10).

var may be any scalar type. You cannot use intval on arrays or objects. See also doubleval, strval, settype and Type juggling.

doubleval

Name

doubleval — Get double value of a variable.

Description

double doubleval(mixed var);

Returns the double (floating point) value of var.

var may be any scalar type. You cannot use doubleval on arrays or objects. See also intval, strval, settype and Type juggling.

empty

Name

empty — determine whether a variable is set

Description

strval

int empty(mixed var);

Returns false if var exists and has a value; true otherwise. See also isset.

Name

strval — Get string value of a variable.

Description

string strval(mixed var);

Returns the string value of var.

var may be any scalar type. You cannot use strval on arrays or objects. See also doubleval, intval, settype and Type juggling.

is_array

Name

is_array — Finds whether a variable is an array.

Description

int is_array(mixed var);

Returns true if var is an array, false otherwise.

See also is_double, is_float, is_int, is_integer, is_real, is_string, is_long, and

is_object.

is_double

Name

is_double — Finds whether a variable is a double.

Description

int is_double(mixed var);

Returns true if var is a double, false otherwise.

See also is_array, is_float, is_int, is_integer, is_real, is_string, is_long, and

is_object.

is_float

Name

is_float — Finds whether a variable is a float.

Description

int is_float(mixed var);

This function is an alias for is_double.

See also is_double, is_real, is_int, is_integer, is_string, is_object, is_array, and

is_long.

is_int

Name

is_int — Find whether a variable is an integer.

Description

int is_int(mixed var);

This function is an alias for is_long.

See also is_double, is_float, is_integer, is_string, is_real, is_object, is_array, and

is_long.

is_integer

Name

is_integer — Find whether a variable is an integer.

Description

int is_integer(mixed var);

This function is an alias for is_long.

See also is_double, is_float, is_int, is_string, is_real, is_object, is_array, and

is_long.

is_long

Name

is_long — Finds whether a variable is an integer.

Description

int is_long(mixed var);

Returns true if var is an integer (long), false otherwise.

See also is_double, is_float, is_int, is_real, is_string, is_object, is_array, and

is_integer.

is_object

Name

is_object — Finds whether a variable is an object.

Description

int is_object(mixed var);

Returns true if var is an object, false otherwise.

See also is_long, is_int, is_integer, is_float, is_double, is_real, is_string, and

is_array.

is_real

Name

is_real — Finds whether a variable is a real.

Description

int is_real(mixed var);

This function is an alias for is_double.

See also is_long, is_int, is_integer, is_float, is_double, is_object, is_string, and

is_array.

is_string

Name

is_string — Finds whether a variable is a string.

Description

int is_string(mixed var);

Returns true if var is a string, false otherwise.

See also is_long, is_int, is_integer, is_float, is_double, is_real, is_object, and

is_array.

isset

Name

isset — determine whether a variable is set

Description

int isset(mixed var);

Returns true if var exists; false otherwise. See also empty.

settype

Name

settype — Set the type of a variable.

Description

int settype(string var, string type);

Set the type of variable var to type. Possibles values of type are:

  • "integer"

  • "double"

  • "string"

  • "array"

  • "object"

Returns true if successful; otherwise returns false. See also gettype.