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

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

主站蜘蛛池模板: 湖南省| 衡山县| 邵武市| 临桂县| 汨罗市| 买车| 荔浦县| 奉节县| 福清市| 门源| 汽车| 鄱阳县| 凌海市| 无锡市| 平潭县| 江达县| 三台县| 盐城市| 神农架林区| 灵丘县| 拉萨市| 濮阳市| 太白县| 巨鹿县| 罗田县| 贵南县| 金平| 江源县| 杭锦旗| 宁国市| 南城县| 遂平县| 博白县| 西华县| 松滋市| 包头市| 合作市| 来凤县| 石景山区| 林周县| 临猗县|