Zend_Locale_Format number_format数不起作用

时间:2012-08-10 10:43:07

标签: zend-framework format locale

我有这样的代码:

    $options = array(
                    'number_format' => '#.##'
            );
    $value = '22155000000000000048';
    $result = Zend_Locale_Format::getNumber($value, $options);
    var_dump($result);

收到:22155000000000000048

假设:22155000000000000048.00

即使'number_format' => '#.00'没有帮助

1 个答案:

答案 0 :(得分:0)

使用toNumber()而不是getNumber()。正确的格式是'#0.00'

$options = array(
                'number_format' => '#0.00'
        );
$value = '22155000000000000048';
$result = Zend_Locale_Format::toNumber($value, $options);
var_dump($result);