public function format($amount, $code = null) { if (!is_scalar($amount)) { return $amount; } $cleaned = trim(str_replace(',', '.', $amount)); if (!is_numeric($cleaned)) { return $amount; } $currency = $this->getCurrency($code); /*return $currency['left'] . number_format($cleaned, $currency['decimals'], $currency['decsep'], $currency['thsep']) . $currency['right'];*/ return number_format($amount, 2, ',', ' '); } Currency.php
Можливо трошки скоротити if (!is_scalar($amount) || !is_numeric($cleaned)) { return $amount; }
Обсуждают сегодня