PHP Integer Format

no-email (Damien Seguy), Damien Seguy
Sun, 04 Aug 2024 00:00:00 +0000

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.