Hexadecimal Separator¶
<?php
echo 123_456;
echo 12.45_56;
echo 0x12_34;
echo 0b111_110_001;
echo 0b111_110_00_1;
echo mb_chr(0x1F_418); // OK
echo "\u{1F4_18}"; // KO
?>
PHP offers a number separator since PHP 8.0: _. It may be added inside any integer or float, to make long list of digits more readable.
In fact, this also applies to the other integer notations: hexadecimal, octal, binary, etc. Just don’t put it inside the header, like 0_x_1, but in the body of the integer.
Interestingly, the separator does not work in string sequences, like inside an hexadecimal unicode representation.
See Also¶
Hexadecimal separated [Try me]
PHP Error Messages¶
PHP Features¶
Last updated: 14 July 2026