When the user enters a number from 1000 and above I want to be able to get the thousand for that number in an array.
For example…
Number entered by user: 165124
My array should return:
array('thousand_low' => 165000, 'thousand_high' = 165999)
Thanks!
The complete array-returning function, using PHP's native floor and ceil functions:
function get_thousands($num) {
return array(
'thousand_low'=>floor($num/1000)*1000,
'thousand_high'=>ceil($num/1000)*1000-1
);
}
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