功能要求
将指定的字符串进行类型转换。
实例代码
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>类型转换</title>
</head>
<body>
<?php
$num = '3.1415926r*r';
echo '使用(integer)操作符转换变量$num类型:';
echo (integer)$num;
echo '<p>';
echo '输出变量$num的值:'.$num;
echo '<p>';
echo '使用settype函数转换变量$num类型:';
echo settype($num, 'integer');
echo '<p>';
echo '输出变量$num的值:'.$num;
?>
</body>
</html>
运行结果