Page 1 of 1

int to float

Posted: Thu Nov 16, 2006 2:54 am
by itsmani1
i want to convert int to float how can i do so?

Code: Select all

$a = 10;
echo $a/5;
should give 2.00 not 2

Posted: Thu Nov 16, 2006 4:27 am
by aaronhall
You'll probably want to use sprintf instead

Posted: Thu Nov 16, 2006 6:34 am
by Jenk

Code: Select all

$a = (float) 5;

Posted: Thu Nov 16, 2006 8:57 am
by evilchris2003
just use float instead of the int in the 1st place