5.4.0 This function now supports multiple bytes in dec_point and thousands_sep. Only the first byte of each separator was used in older versions.
Based on that, here's a very hacky fix for the problem in older PHP versions, short of rolling your own implementation of number_format
:
$separator = ' ';
echo preg_replace('/(?<=\d)\x' . bin2hex($separator[0]) . '(?=\d)/',
$separator,
number_format($value, 0, '.', $separator));