user111671 - 5 months ago 79x

Javascript Question

If I have

`a.toFixed(3);`

Answer

I found that `sprintf`

and `number_format`

both round the number, so i used this:

```
$number = 2.4232;
$decimals = 3;
$expo = pow(10,$decimals);
$number = intval($number*$expo)/$expo; // = 2423/100
```

Source (Stackoverflow)

Comments