interface type_cast_helper_interface

An interface for type cast operations.

Methods

addslashes_recursively(mixed $var)

Recursively applies addslashes to a variable.

add_magic_quotes(mixed $var)

Recursively applies addslashes to a variable if magic quotes are turned on.

set_var(mixed $result, mixed $var, mixed $type, bool $multibyte = false)

Set variable $result to a particular type.

recursive_set_var(string $var, mixed $default, bool $multibyte)

Recursively sets a variable to a given type using {@link set_var set_var}.

Details

at line 26
addslashes_recursively(mixed $var)

Recursively applies addslashes to a variable.

Parameters

mixed $var &$var Variable passed by reference to which slashes will be added.

at line 33
add_magic_quotes(mixed $var)

Recursively applies addslashes to a variable if magic quotes are turned on.

Parameters

mixed $var &$var Variable passed by reference to which slashes will be added.

at line 44
set_var(mixed $result, mixed $var, mixed $type, bool $multibyte = false)

Set variable $result to a particular type.

Parameters

mixed $result &$result The variable to fill
mixed $var The contents to fill with
mixed $type The variable type. Will be used with {@link settype()}
bool $multibyte Indicates whether string values may contain UTF-8 characters. Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks.

at line 58
recursive_set_var(string $var, mixed $default, bool $multibyte)

Recursively sets a variable to a given type using {@link set_var set_var}.

Parameters

string $var The value which shall be sanitised (passed by reference).
mixed $default Specifies the type $var shall have. If it is an array and $var is not one, then an empty array is returned. Otherwise var is cast to the same type, and if $default is an array all keys and values are cast recursively using this function too.
bool $multibyte Indicates whether string keys and values may contain UTF-8 characters. Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks.