pixelscape
asked on
Shorten variable to 100th decimal place
I have a variable, $item_price, whose value is 55.0000
I want to shorten the number to the 100th place. I was trying to do the following but do not get output when I echo $item_price2. I wonder if I need to convert this value from a string to a number?? Thoughts?
$item_price2 = number_format($item_price,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks mankowitz. That was it.
Do you really want 100 decimal places? Or do you mean 2 decimals? The code you have posted should work for 2 decimals. What happens when you run the script?