简单类型 / 数字 / Integer

<?php

//decimal number system
$decimal = 42;

//octal number system
$octal = 042;
//octal is 34

//hexadecimal number system
$hexadecimal = 0x42;
//hexadecimal is 66

//binary number system
$binary = 0b1010;
//binary is 10

//42 to decimal string
$sDecimal = (String)42;
//sDecimal is "42"

//42 to octal string
$sOctal = base_convert((string42108);
//sOctal is "52"

//42 to hexadecimal string
$sHexadecimal = base_convert((string421016);
//sHexadecimal is "2a"

//42 to binary string
$sBinary = base_convert((string42102);
//sBinary is "101010"

echo $decimal, "\n";
echo $octal, "\n";
echo $hexadecimal, "\n";
echo $binary, "\n";
echo $sDecimal, "\n";
echo $sOctal, "\n";
echo $sHexadecimal, "\n";
echo $sBinary;