脚本宝典收集整理的这篇文章主要介绍了PHP 类型转换函数intval,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$id = intval(
$_GET['id']);
intval
(
PHP 4,
PHP 5)
intval — Get the integer value of a
VARiable
Description
int intval ( mixed $var [,int $base= 10 ] )
Returns the integer value of var,using the s
PEcified base for the conversion (the default is base 10).
Par
ameters
var
The scalar value b
eing converted to an integer
base
The base for the conversion (default is base 10)
Return Values
The integer value of var on success,or 0 on f
ailure. Empty arrays and objects return 0,non-empty arrays and objects return 1.
The maximum value depends on the sy
stem. 32 b
IT sy
stems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a sy
stem,intval('1000000000000') will return 2147483647. The maximum signed integer value for 64 bit sy
stems is 9223372036854775807.
Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of integer casting apply.
Examples
代码如下:脚本宝典总结
以上是脚本宝典为你收集整理的PHP 类型转换函数intval全部内容,希望文章能够帮你解决PHP 类型转换函数intval所遇到的问题。
如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。