<!--(boolean)转成布尔型--> <!--(string)转成字符串型--> <!--(integer)转成整型--> <!--(float)转成浮点型--> <!--(array)转成数组--> <!--(object)转成对象--> <!--settype(变量,'类型') 转后原变量改变--> <?php $num = '3.141592653r*r'; echo '使用(integer)转成整型:'; echo (integer)$num; echo '<p>'; echo '不转换输出原来的变量'; echo $num; echo '<p>'; echo '使用函数settype()转换变量类型'; settype($num,'integer'); //这里integer要单引号不然报错 echo $num; echo '</p><p>'; echo '输出函数转换后的变量'; echo $num /* 注意用函数settype()后变量本身已转换,而(float)等变量本身没变只输出变了 */ ?></p>
The above introduces the PHP self-study no00011 data type conversion, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.