[PHP 手冊] -Integer 整型
[PHP 手冊] –Integer 整型
資料來源: http://www.ithome.com/html/soft/72723.htm
code2html:http://tohtml.com/
01.語法
整型值可以使用十進位,十六進位,八進制或二進位表示,前面可以加上可選的符號(- 或者 +)。
二進位表達的 integer 自 PHP 5.4.0 起可用。
要使用八進制表達,數位前必須加上 0(零)。要使用十六進位表達,數位前必須加上 0x。要使用二進位表達,數位前必須加上 0b。
Example #1 整數文字表達
<?php
$a = 12340; // 十進位數字
$a = -123; // 負數
$a = 0123; // 八進位數 (等於十進位 83)
$a = 0x1A; // 十六進位數 (等於十進位 26)
?>