Thousand separator PHP
P粉848442185
P粉848442185 2023-11-07 12:00:02
0
1
707

I extracted this $number = 100000.5; from the database.

What I need is to set the format to 100.000,5

str_replace number_format I guessed it.

My replacement worked perfectly,

echo str_replace('.', ',', $row['anskaf_sum']);

(return: 100000,5) But when I add number_format I somehow fail

number_format($row['anskaf_sum'] , 0, ',', '.');

return

101

I've tried a few other approaches but I can't seem to get close to the answer I need

Thanks.

P粉848442185
P粉848442185

reply all(1)
P粉151720173

Are you sure your $row['anskaf_sum'] doesn't contain values ​​you don't expect? because:

<?php
        $number = 100000.5;
        echo number_format($number, 1, ",", ".");
?>

...this will return the result you want: 100.000,5

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template