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 ); } }
Expand full source code Collapse full source code View on GitHub
Methods Methods
- __construct — Constructor
- format_money — Format number to money with decimals
- format_money_no_decimal — Format number to money with no decimals
- whole_number — Converts and rounds a decimal to a whole number