LLMS_Number

Number Class


Description Description

Manages formatting numbers for I/O and display


Source Source

File: includes/class.llms.number.php

class LLMS_Number {

	/**
	 * Constructor
	 */
	public function __construct() {

	}

	/**
	 * Format number to money with decimals
	 * @param  [int] $number
	 * @return [string]
	 */
	public static function format_money( $number ) {

		return get_lifterlms_currency_symbol() . number_format( (int) $number, 2, '.', ',' );

	}

	/**
	 * Format number to money with no decimals
	 * @param  [int] $number
	 * @return [string]
	 */
	public static function format_money_no_decimal( $number ) {
		return get_lifterlms_currency_symbol() . number_format( $number );
	}

	/**
	 * Converts and rounds a decimal to a whole number
	 * @param  [decimal] $decimal [percentage]
	 * @return [int]        [whole number representation of decimal value]
	 */
	public static function whole_number( $decimal ) {

			return round( $decimal * 100 );

	}

}

Top ↑

Methods Methods


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.