ICantStopThinkinofYouPHP类型转换函数intval

ICantStopThinkinofYouPHP类型转换函数intval

内容导读

收集整理的这篇技术教程文章主要介绍了ICantStopThinkinofYouPHP类型转换函数intval,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1546字,纯文字阅读大概需要3分钟

内容图文

PHP代码
$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 specified base for the conversion (the default is base 10).
Parameters
var
The scalar value being 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 failure. Empty arrays and objects return 0, non-empty arrays and objects return 1.
The maximum value depends on the system. 32 bit systems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a system, intval('1000000000000') will return 2147483647. The maximum signed integer value for 64 bit systems 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

代码如下:


echo intval(42); // 42
echo intval(4.2); // 4
echo intval('42'); // 42
echo intval('+42'); // 42
echo intval('-42'); // -42
echo intval(042); // 34
echo intval('042'); // 42
echo intval(1e10); // 1410065408
echo intval('1e10'); // 1
echo intval(0x1A); // 26
echo intval(42000000); // 42000000
echo intval(420000000000000000000); // 0
echo intval('420000000000000000000'); // 2147483647
echo intval(42, 8); // 42
echo intval('42', 8); // 34
?>

以上就介绍了I Cant Stop Thinkin of You PHP 类型转换函数intval,包括了I Cant Stop Thinkin of You方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

内容总结

以上是为您收集整理的ICantStopThinkinofYouPHP类型转换函数intval全部内容,希望文章能够帮你解决ICantStopThinkinofYouPHP类型转换函数intval所遇到的程序开发问题。 如果觉得技术教程内容还不错,欢迎将网站推荐给程序员好友。

内容备注

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。



联系我们

在线咨询:点击这里给我发消息

邮件:w420220301@qq.com