Hello everyone i am trying to format the input number range with php number_format
INPUT Probability
- 1234
- 12345
- 123456789
- 123456789,50
- 123.45,00
- 123.456.78,50
OUTPUT should be
dot should be in multiplier of 3 digit and last two (if available in input range) digits should be come with comma separater
- 1.234,00
- 12.345,00
- 123.456.789,00
- 123.456.789,50
- 12.345,00
- 12.345.678,50
out put should be as per dutch format and dot should be in multiplier of 3 digit and last two digits should be come with comma separater
like, here is link you can put any input value from above list in textbox you can get output like shown below
the code which i am using
echo numberFormat('12345');
function numberFormat($num)
{
return preg_replace("/(?<=\d)(?=(\d{3})+(?!\d))/",".",$num);
}
but it will not work with (4),(5),(6) from my input probability to match with outputs.
Well I think is like this:
About the input yo could check and all the “.” remove it and the “,” replace with “.”
I hope it helps