I would like to round a number to two decimal places in PHP.
PHP code:
$bmi = ($form_state[values][submitted][1] * 703) /
($form_state[values][submitted][10] * $form_state[values][submitted][10]);
$form_values['submitted'][11] = $bmi;
$form_values['submitted_tree'][11] = $bmi;
What is the best way to round the variable $bmi?
Edit3:
Well if I understand your code right it should go like this:
If anything goes wrong I can only assume that the calculated $bmi var gets messed up somewhere.
Is it supposed that you fill the unrounded value into $form_values[‘submitted’][11]? if not try the following: