I am waek in math can you do a favor and write a function for me?
For example l pass a number like this
1986345.650
It should have a constant separator like SEPARATOR that would be for example , then the function returns
1,986,345.65
The decimal part should be rounded to 2 digits too.
<?php
$number = 1986345.650;
function convertNum($number) {
return number_format($number, 2);
}
echo $number = convertNum($number);
Which php extension does these functions need? Actually i need a custom func to avoid need of any particular extension. Plz help.
The only function that code uses, apart from convertNum which is defined right there, is number_format which is part of standard php: