DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   PHP (http://www.daniweb.com/forums/forum17.html)
-   -   convert integer number to float number (http://www.daniweb.com/forums/thread147132.html)

php2sheik Sep 22nd, 2008 12:48 pm
convert integer number to float number
 
hai

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

for ex
i want to convert 500 to 500.00

Will Gresham Sep 22nd, 2008 1:03 pm
Re: convert integer number to float number
 
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

php2sheik Sep 23rd, 2008 1:30 am
Re: convert integer number to float number
 
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

Will Gresham Sep 23rd, 2008 10:26 am
Re: convert integer number to float number
 
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.


All times are GMT -4. The time now is 12:45 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC