convert integer number to float number

Reply

Join Date: Sep 2008
Posts: 18
Reputation: php2sheik is an unknown quantity at this point 
Solved Threads: 1
php2sheik php2sheik is offline Offline
Newbie Poster

convert integer number to float number

 
0
  #1
Sep 22nd, 2008
hai

i want to convert interger number to float number, how in php?

for ex
i want to convert 500 to 500.00
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: convert integer number to float number

 
0
  #2
Sep 22nd, 2008
Can you give an example of what you are actually trying to acheive, PHP doesn't work with datatypes in the same way as many other scripting/programming languages.

Read the last paragraph on http://phpbuilder.com/manual/en/lang...pes.string.php
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 18
Reputation: php2sheik is an unknown quantity at this point 
Solved Threads: 1
php2sheik php2sheik is offline Offline
Newbie Poster

Re: convert integer number to float number

 
0
  #3
Sep 23rd, 2008
i want to just display the 500 to 500.00 in webpage. how can i achieve with php

For example
name cost
item1 500.00
item2 350.00
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 524
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro

Re: convert integer number to float number

 
0
  #4
Sep 23rd, 2008
Just store the numbers with the decimal value, if they are in a MySQL database there is a DECIMAL datatype for this, in MSSQL there is a CURRENCY one. If the values are hard-coded into the scripts, just add .00 to the end of them.

If I am missing the point please provide a code example as you are giving little to go by on what you want.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC