PHP Integer Format

../_images/php_integer_format.png

PHP has several convenient integer format to write them in a proper way: 0x12F, 0b110101, 0o12367. This works well as part of the code

When such formats are provided as a string, it may be processed with the ad hoc native functions such as hexdec(), bindec() or octdec() : they convert a number between bases, and they also accept the native PHP formats.

For the reverse operation, the reverse functions are also useful, with an extra header for the format.

See Also

PHP Features