Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
/**
12
 * NumberHelper.
13
 *
14
 * @package    symfony
15
 * @subpackage helper
16
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17
 * @version    SVN: $Id: NumberHelper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
18
 */
19
 
20
function format_number($number, $culture = null)
21
{
22
  if (null === $number)
23
  {
24
    return null;
25
  }
26
 
27
  $numberFormat = new sfNumberFormat(_current_language($culture));
28
 
29
  return $numberFormat->format($number);
30
}
31
 
32
function format_currency($amount, $currency = null, $culture = null)
33
{
34
  if (null === $amount)
35
  {
36
    return null;
37
  }
38
 
39
  $numberFormat = new sfNumberFormat(_current_language($culture));
40
 
41
  return $numberFormat->format($amount, 'c', $currency);
42
}
43
 
44
function _current_language($culture)
45
{
46
  return $culture ? $culture : sfContext::getInstance()->getUser()->getCulture();
47
}