settype
设置变量的类型
settype()
函数将变量转换为特定类型。
将变量转换为特定类型:
<?php $a = "32"; // string settype($a, "integer"); // $a 现在是整数 $b = 32; // integer settype($b, "string"); // $b 现在是字符串 $c = true; // boolean settype($c, "integer"); // $c 现在是整数 (1) ?>
亲自试一试
settype(variable, type);
参数 | 描述 |
---|---|
variable | 必需。指定要转换的变量。 |
type |
必需的。指定要将变量转换为的类型。可能的类型有:
|