lets say I've got an
$possibleTaxes = array(7,8,13,23);
and then I've got some values like 13.05
, 18
, 6.5
etc. I need function that will return given number rounded to closest values from those inside given array so:
roundToValues(19,$possibleTaxes) //returns 23
roundToValues(16,$possibleTaxes) //returns 13
Also additional option to round only to bigger value, even if smaller is closer would be good