HI neel
I want to convert integer value of variable to float ie. i am adding two variables and the addition is integer and i want convert it to float
eg:
$var1=30;
$var2=40;
$var3=$var1+$var2;


i want to display var3 as 70.00
please tell me how to do this
Thank you

Convert isn't the issue - you want to format the number with forced decimal places. Check out the PHP number_format function

echo number_format($var3,2);

commented: nice +2

number_format function is good one and you can use

floatval($var3

floatval fuction is did not show .00 (null) value,
but it will show .1 like ....

HI neel
I want to convert integer value of variable to float ie. i am adding two variables and the addition is integer and i want convert it to float
eg:
$var1=30;
$var2=40;
$var3=$var1+$var2;


i want to display var3 as 70.00
please tell me how to do this
Thank you

It worked,Thanks sir

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.