Result split with decimal place without rounding php

Asked

Viewed 779 times

0

I’m trying to get a two-decimal division with no rounding. For example, I want 1000/7 to return 142.85 instead of 142.86 (The result of this account is 142.857142. I’m using number_format for this, but it rounds the last decimal place. Could someone help me?
Thank you!

1 answer

2


You can use any of the following functions below:

floor(($numero*100))/100;
intval(($numero*100))/100;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.