rounding - PHP auto convert price to 99 rather than 100 -


i have different prices:

100 550 799 1200 350 

wonder how can automatically convert them

99 549 799 1200 349 

i'd -1, correct 799, , don't want 798.

cant think of way conversion php not great math. bet need find if divides 2 if yes subtract 1 if not nothing.

if ($price % 2) {    $price = intval($price) - 1; } 

is best way it?

something this?

if(($price % 10) == 0) {     $price--; } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -