Posted by Arjun on Saturday 4th January 2020

PHP 7.4 - Numeric Literal Separator

PHP 7.4

PHP 7.4 allows for underscores to be used to visually separate numeric values. It looks like this:

$unformattedNumber = 123456789.78;
$formattedNumber = 123_456_789.78;

The underscores are simply ignored by the engine. i.e both are equal.