本文整理汇总了PHP中Zend_Currency::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Currency::toString方法的具体用法?PHP Zend_Currency::toString怎么用?PHP Zend_Currency::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Currency
的用法示例。
在下文中一共展示了Zend_Currency::toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: currency
/**
* Format a numeric currency value and return it as a string
*
* @param int|float $value any value that return true with is_numeric
* @param array $options additional options to pass to the currency
* constructor
* @param string $locale locale value
*
* @throws InvalidParameterException if the $value parameter is not numeric
* @return string the formatted value
*/
public function currency($value, $options = array(), $locale = null)
{
if (!is_numeric($value)) {
throw new InvalidArgumentException('Numeric argument expected ' . gettype($value) . ' given');
}
$options = array_merge($options, array('value' => $value));
$currency = new Zend_Currency($options, $locale);
return $currency->toString();
}
示例2: testConstructorAllowsOverridingCurrencyDisplayFormat
/**
* @group ZF-11798
* @dataProvider providerConstructorAllowsOverridingCurrencyDisplayFormat
*/
public function testConstructorAllowsOverridingCurrencyDisplayFormat($display, $expected)
{
$currency = new Zend_Currency(array('value' => 100, 'display' => $display), 'en_US');
$this->assertEquals($expected, $currency->toString());
}
示例3: testCurrencyWithSelfPattern
/**
* @ZF-9491
*/
public function testCurrencyWithSelfPattern()
{
$currency = new Zend_Currency(array('value' => 10000, 'format' => '#,#0', 'locale' => 'de_DE'));
$this->assertEquals('1.00.00', $currency->toString());
}
示例4: testToString
/**
* testing toString
*
*/
public function testToString()
{
$USD = new Zend_Currency('USD', 'en_US');
$this->assertSame($USD->toString(), 'US Dollar');
}
示例5: testContructingPrecisionValues
/**
* IsLess values
*/
public function testContructingPrecisionValues()
{
$currency = new Zend_Currency(array('value' => 100.5));
$this->assertEquals('€ 100,50', $currency->toString('de_AT'));
}
示例6: getZendPrice
/**
* Get zend price
*/
public function getZendPrice()
{
$zc = new Zend_Currency(array('value' => $this->_get('price')), strtoupper(Model_Lang::getCurrent()));
return $zc->toString();
}