Jump to content

Math Multiplication


sunziun
 Share

Recommended Posts

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

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 by astralaaron
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...