settype

settype

settype

settype
- It set the type of a variable

Syntax:

bool settype ( mixed var, string type)

- It returns TRUE if successful; otherwise returns FALSE.

Some of the possibles values of type are:

“boolean”

“integer”

“float”

“string”

“array”

“object”

“null”

Example:

$test1 = “5bar”; // string
$test2 = true;   // boolean

settype($test1, “integer”);
here the value of $test1 “5bar” (string) is converted to 5 (integer).
settype($test2, “string”);
here the value of $test2 “true” (boolean) is converted to “1″ (string).

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.