Result division with decimal no rounding php [duplicate]

0

I'm trying to get a split with 2 decimal places without rounding. For example, I want 1000/7 to return 142.85 instead of 142.86 (The result of this account is 142.857142.) I am using number_format for this, but it rounds the last decimal place. Thanks!

    
asked by anonymous 30.11.2018 / 16:00

1 answer

2

You can use any of the following functions below:

floor(($numero*100))/100;
intval(($numero*100))/100;
    
30.11.2018 / 16:12