Skip to content

PHP 7.4 – Numeric Literal Separator

Last updated on January 30, 2021

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.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments