$_val) { $$_key = smarty_function_escape_special_chars($_val); } if (strpos($value, '.')) { $loop = TRUE; while ($loop) { if (substr($value, -1) == '0') { $value = substr($value, 0, -1); } else { $loop = FALSE; if (substr($value, -1) == '.') { $value = substr($value, 0, -1); } } } } if ($padding > 0) { if ($decimal_pos = strpos($value, '.')) { $decimals = strlen(substr($value, ($decimal_pos+1))); for ($i=$decimals; $i<$padding; $i++) { $value .= '0'; } } else { $value .= '.'; for ($i=0; $i<$padding; $i++) { $value .= '0'; } } } return $value; }