user4fun Posted October 16, 2006 Share Posted October 16, 2006 $answer1 = "$var1/$Var2<br>";echo "$answer1<br>";i need to make $message1 round to 2 decimal placesThanksNOTEif i have to take the quotation of, then what do i need to do to add text before and after $answer1 Link to comment Share on other sites More sharing options...
mona Posted October 16, 2006 Share Posted October 16, 2006 to round you can use the round function, see the php manualhttp://us2.php.net/manual/en/function.round.phpyou'll need something like: round($answer1,2);if u want to remove the quotations simply you have to concatenate the string and in php the concatenation is as follows:echo "hi ". $name. ", how r u?";so u need to close the quotations then add dots before and after the string Link to comment Share on other sites More sharing options...
justsomeguy Posted October 16, 2006 Share Posted October 16, 2006 Quotation marks denote a literal string of characters. Which includes the division operator, you are telling it to display a slash. If you want to actually perform the division, then don't put it in quotes. Link to comment Share on other sites More sharing options...
user4fun Posted October 17, 2006 Author Share Posted October 17, 2006 awesome,work like a charm.thank you both for your time Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now