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

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

主站蜘蛛池模板: 泸水县| 多伦县| 临泉县| 德江县| 漳州市| 康平县| 江川县| 永福县| 江津市| 邹城市| 普安县| 台州市| 新泰市| 浦县| 临沂市| 格尔木市| 峨眉山市| 五常市| 抚松县| 甘洛县| 班戈县| 石首市| 蓝田县| 叙永县| 云南省| 鄂州市| 林口县| 吴忠市| 洛南县| 略阳县| 连城县| 石渠县| 翁牛特旗| 新和县| 蕉岭县| 三江| 沙河市| 松潘县| 阿拉善盟| 东港市| 扶余县|