F
F
fiks_bags0092021-06-27 18:08:38
PHP
fiks_bags009, 2021-06-27 18:08:38

How to perform division with a remainder in php and get the correct result?

Good time!
I can't beat the puzzle how to divide in php so that the number gives out with the correct remainder, and not "crazy".

Please help php experts, I broke my whole head) I will give

examples here is the code:

<?php
      $one	= 100;
      $two	= 2396100;
      $ravno = $one / $two;
echo		round($ravno, 9);
?>

In this code, we get the following result: "4.1734E-5", but we should get this 0.000041734

Now, if we take this code:
<?php
      $one	= 350;
      $two	= 2396100;
      $ravno = $one / $two;
echo		round($ravno, 9);
?>

We get the desired result : 0.000146071 .

Help with advice on how you can finish it so that it always displays in the correct format when dividing, and not in this " 4.1734E-5 ".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-06-27
@fiks_bags009

The number is correct, that's what output functions like echo do. Set the number_format function
on this number in exponential notation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question