sunziun Posted June 25, 2012 Share Posted June 25, 2012 Hello Everyone, what could be the solution for this problem? $sa=0.15; $sb=1.30; echo $sa * 3;echo $sb * 3; result for $sa I get correct calculation of 0.45 but for $sb instead of 3.9 I get wrong calculation of 1.33.9. what can I do to fix this issue? Link to comment Share on other sites More sharing options...
astralaaron Posted June 25, 2012 Share Posted June 25, 2012 (edited) Hello Everyone, what could be the solution for this problem? $sa=0.15; $sb=1.30; echo $sa * 3;echo $sb * 3; result for $sa I get correct calculation of 0.45 but for $sb instead of 3.9 I get wrong calculation of 1.33.9. what can I do to fix this issue? It looks like you are getting an answer of 1.3 and then 3.9if you echo out a break line in between them it would look right echo '<br />'; EDIT: I ran the code you posted and got: 0.453.9 so, 0.45 and 3.9 Edited June 25, 2012 by astralaaron Link to comment Share on other sites More sharing options...
sunziun Posted June 25, 2012 Author Share Posted June 25, 2012 I dont get 3.9 for $sb.I get 1.33.9 thats the problem I have. Link to comment Share on other sites More sharing options...
ShadowMage Posted June 25, 2012 Share Posted June 25, 2012 As astralaaron pointed out, it looks as though it printing 1.3 then 3.9 with no spaces. It appears you are first printing out $sb, then printing the product of $sb.Are you sure the code you posted is exactly the code you're running? Link to comment Share on other sites More sharing options...
sunziun Posted June 25, 2012 Author Share Posted June 25, 2012 my bad you guys are right! 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