色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

PHP 類型轉換函數intval

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
復制代碼 代碼如下:
<?php
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
?>

php技術PHP 類型轉換函數intval,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 钦州市| 天祝| 五原县| 卢湾区| 刚察县| 天长市| 宁海县| 陕西省| 牡丹江市| 马龙县| 吉安市| 邹城市| 嘉黎县| 淳化县| 同德县| 宕昌县| 德庆县| 嘉定区| 镇安县| 防城港市| 双鸭山市| 大竹县| 昌吉市| 天镇县| 花垣县| 绵竹市| 陈巴尔虎旗| 苏尼特右旗| 阿克苏市| 顺义区| 左云县| 泽普县| 广元市| 胶州市| 布尔津县| 博罗县| 蛟河市| 凯里市| 本溪| 兴化市| 华容县|