skip to Main Content

I have a value 0.11851999999956049 and I want to multiply with 1000000000000000000
Now when I do 0.11851999999956049 * 1000000000000000000 it give me output = 1.185199999995605e+17

I do not want output like e+17 notation.

I want output with only 2 decimal value. I want output 1.18

I tried number_format but it is not working.

2

Answers


  1. tbh i have no idea but i think this should work or sum like this have fun 🙂
    var_dump(round($number, 2));

    Login or Signup to reply.
  2. First of all your multiplication is wrong and i am not sure what you really asked.

    You can format a number with grouped thousands and decimals,

    $num =0.11851999999956049 * 1000000000000000000;
    echo(number_format($num,2,'.',''));
    

    Results: 118519999999560496.00

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search