Jump to content

retaining zeros


brandonboyce

Recommended Posts

I have some numbers such as 44.1, 44.2, 44.3,.....,44.10, 44.11 where I need to keep the last zero in the 44.10. My trouble is that if I set the data type as a decimal with 2 decimal places 44.1 becomes 44.10 which I don't want and if I save the data type as float then my 44.10 becomes 44.1. I have been able to retain the trailing zero by saving data as text but then it doesn't sort properly 16.x comes before 2.x. Hopefully someone can make sense of what I am trying to accomplish, thanks in advance for any help provided.

Link to comment
https://forums.phpfreaks.com/topic/226239-retaining-zeros/
Share on other sites

Sorry for the delayed reply, I've been caught up on other projects...anyway @DavidAM yes the data SHOULD be formatted like that unfortunately the existing data isn't and I am not able to change it.

 

@corbin thanks for the suggestion I will look into number_format and see what I can do.

Link to comment
https://forums.phpfreaks.com/topic/226239-retaining-zeros/#findComment-1171403
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.