xProteuSx Posted April 17, 2009 Share Posted April 17, 2009 I have, in a database, integers stored in scientific notation, such as '5e+06'. How can I format this number using PHP to output a real integer value, such as 5000000, instead of '5e+06'?? Quote Link to comment https://forums.phpfreaks.com/topic/154445-solved-number-formatting/ Share on other sites More sharing options...
keeB Posted April 17, 2009 Share Posted April 17, 2009 Write a function that takes scientific notation and converts it to an integer. Quote Link to comment https://forums.phpfreaks.com/topic/154445-solved-number-formatting/#findComment-812078 Share on other sites More sharing options...
xProteuSx Posted April 17, 2009 Author Share Posted April 17, 2009 I'm sorry to say, but that's not very helpful. If I was good enough at PHP I would not be in the forum asking if there was a function that did this, would I? I have no idea how to even go about writing such as script because it would get a little complex if the numbers following the 'E' went into double, triple, quadruple digits. Quote Link to comment https://forums.phpfreaks.com/topic/154445-solved-number-formatting/#findComment-812084 Share on other sites More sharing options...
keeB Posted April 17, 2009 Share Posted April 17, 2009 I' sorry to say, I'm not going to write the function for you. How about you try to do what you know, and ask for help on the edge cases as needed? From there I'll be happy to help! Quote Link to comment https://forums.phpfreaks.com/topic/154445-solved-number-formatting/#findComment-812093 Share on other sites More sharing options...
xProteuSx Posted April 17, 2009 Author Share Posted April 17, 2009 Usually I wouldn't waste my time, but here goes: I did not ask you to write any scripts for me. Refer to the original post if you're confused about this. And yes, I will work my way through this, and will do so happily. I will probably come back to these forums for help if needed, because the help I have received here is exemplary for the most part (and I return the favor whenever possible) ... ... except for those few like yourself, who seem to post unhelpful replies (ie. Question: what color is a banana? Answer: 12). I am leaning towards the user rating for posts such as yours. The more you get, the better your title, the better you feel about yourself? Please, don't waste anyone's time with 'write some code that will do that' answers. Quote Link to comment https://forums.phpfreaks.com/topic/154445-solved-number-formatting/#findComment-812103 Share on other sites More sharing options...
keeB Posted April 17, 2009 Share Posted April 17, 2009 Excuse me? You asked how to do it and I told you. You then said my answer was not adequate because you have no idea how to do it. My response? Do what you can and ask for help with the rest. I don't understand how I am being unreasonable or rude.. Quote Link to comment https://forums.phpfreaks.com/topic/154445-solved-number-formatting/#findComment-812109 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.