3

I have been looking for few hours now and can't figure out a solution.

I need a way to round up a price to it's upper decimal, in my template (smarty, I can't edit any php file) I tried with the round function, but can't figure out how to give the mode parameter "PHP_ROUND_HALF_UP".

Here is what I got so far, that makes a standard round

{(($x+7.5+($x-15)*0.3)/15)|round:"1"}

But it returns 3.2 for x=35 instead of 3.3

Tell me if you need any additional infos.

Cypc
  • 177
  • 1
  • 9

1 Answers1

2

A bit of sleep and here comes a solution !

Instead of looking for a function, I found that nifty use of ceil :

{(((($x+7.5+($x-15)*0.3)/15)/0.1)|ceil)*0.1}

Simple math, thanks php.net comments !

Cypc
  • 177
  • 1
  • 9