I am working to convert an excel formula to php function. Now I am facing a problem that is round up as the fraction. Please let me explain it:
- (2 * 18)/2.98 = 12.08 but according to my requirement it should be 12.25
- (2 * 18.5)/2.98 = 12.416 but according to my requirement it should be 12.50
- (2 * 18.8)/2.98 = 12.617 but according to my requirement it should be 12.75
In excel, it is done like :
- ceiling(( 2 * 18 )/2.98, 0.25) = 12.25
- ceiling(( 2 * 18.5 )/2.98, 0.25) = 12.50
- ceiling(( 2 * 18.8 )/2.98, 0.25) = 12.75
I tried in PHP. Ceil() and Floor() do not serve the purpose as these 2 shall give output 13 and 12 accordingly.
Another one round() uses these options PHP_ROUND_HALF_UP, PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, or PHP_ROUND_HALF_ODD
which does not serve the purpose.
Anyone there to help me?