Menu Samaritan's Purse

SETTYPE

Set the type of a variable

SYNTAX

settype ( mixed &$var , string $type ) : bool

PARAMETERS

var

The variable being converted.

type

Possibles values of type are:

"boolean" or "bool"

"integer" or "int"

"float" or "double"

"string"

"array"

"object"

"null"

RETURN

Returns TRUE on success or FALSE on failure.

EXAMPLES

1

bool(false)
int(0)

2

int(0)
bool(false)

3

int(0)
float(0)

4

float(0)
int(0)

5

float(0)
string(1) "0"

6

string(3) "0.0"
float(0)

PHP