Jump to content

Math Multiplication


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...