Join Up!
(PHP 4, PHP 5)
settype — Set the type of a variable
Set the type of variable var to type .
The variable being converted.
Possibles values of type are:
Returns TRUE on success or FALSE on failure.
Example #1 settype() example
<?php $foo = "5bar"; // string $bar = true; // boolean settype($foo, "integer"); // $foo is now 5 (integer) settype($bar, "string"); // $bar is now "1" (string) ?>
Note: Maximum value for "int" is PHP_INT_MAX.