色尼玛亚洲综合影院,亚洲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,轉載需保留來源!

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

主站蜘蛛池模板: 罗山县| 舞阳县| 肇东市| 彭阳县| 铁岭县| 榆社县| 沾化县| 马尔康县| 宁河县| 上犹县| 科技| 克拉玛依市| 新龙县| 梁平县| 邵阳县| 无为县| 崇仁县| 土默特右旗| 乌什县| 城市| 虞城县| 峨边| 普宁市| 淮南市| 枝江市| 康马县| 浑源县| 高唐县| 商丘市| 商洛市| 卢湾区| 漳浦县| 信丰县| 万载县| 来凤县| 新河县| 融水| 同仁县| 陆河县| 开化县| 行唐县|