Jump to content

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

you need to be more specific. Like, give a before/after number example. I vaguely remember back in school "convert to a decimal" meant for instance, taking 12345 and making it 123.45 is that what you mean?

 

edit: ah responses already posted.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.