Num
Kohana_Num

Class Contents

Constants

  • None

Properties

  • None

Class declared in SYSPATH/classes/num.php on line 3.

Methods

public static format( )
Kohana_Num

Source Code
public static function format($number, $places, $monetary = FALSE)
{
	$info = localeconv();

	if ($monetary)
	{
		$decimal   = $info['mon_decimal_point'];
		$thousands = $info['mon_thousands_sep'];
	}
	else
	{
		$decimal   = $info['decimal_point'];
		$thousands = $info['thousands_sep'];
	}

	return number_format($number, $places, $decimal, $thousands);
}

public static ordinal( )
Kohana_Num

Source Code
public static function ordinal($number)
{
	if ($number % 100 > 10 AND $number % 100 < 14)
	{
		return 'th';
	}

	switch ($number % 10)
	{
		case 1:
			return 'st';
		case 2:
			return 'nd';
		case 3:
			return 'rd';
		default:
			return 'th';
	}
}