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

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

What I need is to set the format to100.000,5

str_replacenumber_formatI 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:

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

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!