I am trying to check if a number which is inside a variable got a decimal number above 50 , or less than 50. Then depending on if it's 50 or higher, round the decimal number to 99 , and if it's less, round it to 00.
Here is a piece of my code:
public function roundPrice($price)
{
return round( (ceil($price) - 0.01), 2);
}
It makes all decimal numbers round up to 99 . I would need only decimals which are 50 or higher to be rounded in 99, and 49 or less become 00.
How could I achieve this in PHP ? Many thanks, I'm stuck here and don't know much how to do that.