settype
Set the type of variable
settype()
function converts a variable to a specific type.
Convert variables to specific types:
<?php $a = "32" ; // string settype ( $a , "integer" ) ; // $a is now an integer $b = 32 ; // integer settype ( $b , "string" ) ; // $b is now a string $c = true ; // boolean settype ( $c , "integer" ) ; // $c is now an integer (1) ?>
Try it yourself
settype ( variable , type ) ;
parameter | describe |
---|---|
variable | Required. Specifies the variable to convert. |
type |
Required. Specifies the type to convert the variable to. Possible types are:
|