I have a website that contains a list of articles. I want to include a line that says how many articles there are in the DB, however I don't want it to show the exact count.
I would like it to round down to the nearest 10, so for example for 105 articles I would like it to say "100+", etc.
How would I go about doing this?
Quite simple:
floor($num / 10) * 10
docs
To do something similar you have to use the logarithm with base = 10 and round it
$exp= floor(log($num)/log(10));
$num = pow(10,$exp)."+";
This works with 10, 100, 1000 ecc, i think it better do what you asked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With