|
|
You must use either single or double quotes in the first argument of the function call. Failure to do so will result in an undesirable number format. If your output is displayed in an exponential format, you probably left out your quotes. Additionally, any variable used in the first argument must contain a string and not a number.
For example,
$value = 1234567890987654321;
Doesn't work but,
$value = '1234567890987654321';
Does work!
In the example above,'654321' is the number which you want to format and10 is the total number of digits including all of the zeros and numbers in the value.
I most cases the PHP function str_pad will work as well or better and is more efficient. Additionally, str_pad doesn't care if the value is numeric or not.
|