Query: decbin
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
DECBIN(3) 1 DECBIN(3) decbin - Decimal to binarySYNOPSISstring decbin (int $number)DESCRIPTIONReturns a string containing a binary representation of the given $number argument.PARAMETERSo $number - Decimal value to convert Range of inputs on 32-bit machines +-------------------------------------+--------------------------------------+---+ | positive $number | | | | | | | | | negative $number | | | | | | | | return value | | | | | | +-------------------------------------+--------------------------------------+---+ | 0 | | | | | | | | | | | | | |T{ 0 | | | | | | | 1 | | | | | | | | | | | | | |T{ 1 | | | | | | | 2 | | | | | | | | | | | | | |T{ 10 | | | | | | | | | | | 2147483646 | | | | | | | | | | | | | |T{ 1111111111111111111111111111110 | | | | | | |2147483647 (largest signed integer) | | | | | | | | | | | | | |T{ 1111111111111111111111111111111 | | | | (31 1's) | | | | | | | 2147483648 | | | | | | | | | -2147483648 | | | | | | | | 10000000000000000000000000000000 | | | | | | | | | | | 4294967294 | | | | | | | | | -2 | | | | | | | | 11111111111111111111111111111110 | | | | | | |4294967295 (largest unsigned inte- | | | |ger) | | | | | | | | | -1 | | | | | | | | 11111111111111111111111111111111 (32 | | | | 1's) | | | | | | +-------------------------------------+--------------------------------------+---+ Range of inputs on 64-bit machines +-------------------------------------+------------------------------------------------------------------+---+ | positive $number | | | | | | | | | negative $number | | | | | | | | return value | | | | | | +-------------------------------------+------------------------------------------------------------------+---+ | 0 | | | | | | | | | | | | | |T{ 0 | | | | | | | 1 | | | | | | | | | | | | | |T{ 1 | | | | | | | 2 | | | | | | | | | | | | | |T{ 10 | | | | | | | | | | | 9223372036854775806 | | | | | | | | | | | | | |T{ | | | | 111111111111111111111111111111111111111111111111111111111111110 | | | | | | |9223372036854775807 (largest signed | | | |integer) | | | | | | | | | | | | | |T{ | | | | 111111111111111111111111111111111111111111111111111111111111111 | | | | (63 1's) | | | | | | | | | | | |T{ -9223372036854775808 | | | | | | | | | 1000000000000000000000000000000000000000000000000000000000000000 | | | | | | | | | | | | | | | |T{ -2 | | | | | | | | | 1111111111111111111111111111111111111111111111111111111111111110 | | | | | | | | | | | |T{ -1 | | | | | | | | | 1111111111111111111111111111111111111111111111111111111111111111 | | | | (64 1's) | | | | | | +-------------------------------------+------------------------------------------------------------------+---+RETURN VALUESBinary string representation of $numberEXAMPLESExample #1 decbin(3) example <?php echo decbin(12) . " "; echo decbin(26); ?> The above example will output: 1100 11010SEE ALSObindec(3), decoct(3), dechex(3), base_convert(3), printf(3), using %b, %032b or %064b as the format , sprintf(3), using %b, %032b or %064b as the format . PHP Documentation Group DECBIN(3)