Jump to content

[SOLVED] Converting integer to decimal


Recommended Posts

I need to convert an integer to decimal..if no one can get it that's fine, i'm sure I can find another way, but any help would be nice...

basically this is what I need.

 

[psuedo]

user inputs a number

 

convert_to_decimal(number)

number is converted to a decimal

return number

[/psuedo]

 

now how would I go about doing this?

 

Thank you for any help guys!

Link to comment
https://forums.phpfreaks.com/topic/114313-solved-converting-integer-to-decimal/
Share on other sites

Yes...but if it's 100, 100 / 10 = 10. I need this for percentages, so the number that is submitted is the percent, so for instance, if a user inputs 60 it needs to be .60 for the multiplication. Tell me if i'm not making any since.

And before you say that there's a math based programming board, that's for real math problems that need to be solved with code, not simple division.

haha QFT

 

I've never seen someone use QFT on a programming board.  That just made my day. xD

Haha, thanks for all the help guys! I did try the '.' . $number; but it didn't work for me for some reason haha, but once again thanks for everyone that helped! It's greatly appreciated.

 

Edit: Finally got the '.' . $number; working haha! Can't believe the first thing I tried actually works, been stressing over this for about an hour haha! But thanks ONCE againe.

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.