Strings In Depth11 / 18
Up next

Format numbers

<?php
declare(strict_types=1);
// two decimals with default grouping
echo number_format(1234567.891, 2), "\n";
// custom decimal and thousands separators
echo number_format(1234567.891, 0, ".", " "), "\n";
What you're solving

number_format groups and rounds