php设置变量的数据类型,settype()函数
settype()函数设置数据的数据类型 运行后函数直接改变变量的值,设置成功返回true,失败返回false 函数接收两个参数 第一个 需要设置类型的值 第二个 需要设置的目标类型 可能的值: "boolean"或"bool" "integer"或"int" "float" "string" "array" "object" "null" $foo = "5bar" ; // string $bar = true ; // boolean settype ( $foo , "integer" ) ; // $foo 输出 5 settype ( $bar , "string" ) ; // $bar 输出 "1" 来源: CSDN 作者: weixin_41201496 链接: https://blog.csdn.net/weixin_41201496/article/details/104637551