/** * Formats a money value according to the current locale. * * @param float $money * @param string $currency code, e.g. EUR * @return string */ public static function money($money, $currency = null) { $currency = text::currency($currency ? $currency : arr::get(Kohana::config('locale.country'), 2), 'symbol'); $localeconv = localeconv(); return sprintf('%s %s', number_format($money, round($money) == $money ? 0 : 2, $localeconv['mon_decimal_point'], $localeconv['mon_thousands_sep']), $currency); }