
php如何将float转int?
1、使用函数“intval”将float类型数据转为int类型;
$float = 15.222; intval($float);
2、使用“settype()”将float类型数据设置为int类型;
$float = 15.222; settype($float, 'int');
3、在变量前面加上“ (int)”,将其进行强制转换为int。
立即学习“PHP免费学习笔记(深入)”;
$float = 15.222; (int) $float;
推荐教程:《PHP》











