public function amount()
    {
        // Indian Rupee use special format
        if ($this->currency->getCode() == 'INR') {
            $decimals = null;
            $amount = $this->amount;

            // Extract decimals from amount
            if (($pos = strpos($amount, ".")) !== false) {
                $decimals = substr(round(substr($amount, $pos), 2), 1);
                $amount = substr($amount, 0, $pos);
            }

            // Extract last 3 from amount
            $result = substr($amount, -3);
            $amount = substr($amount, 0, -3);

            // Apply digits 2 by 2
            while (strlen($amount) > 0) {
                $result = substr($amount, -2).",".$result;
                $amount = substr($amount, 0, -2);
            }

            return $result.$decimals;
        }

        // Return western format
        return number_format(
            $this->amount,
            $this->currency->getPrecision(),
            $this->currency->getDecimalSeparator(),
            $this->currency->getThousandSeparator()
        );
    }
public function amount()
    {
        // Indian Rupee use special format
        if ($this->currency->getCode() == 'INR') {
            $decimals = null;
            $amount = $this->amount;

            // Extract decimals from amount
            if (($pos = strpos($amount, ".")) !== false) {
                $decimals = substr(round(substr($amount, $pos), 2), 1);
                $amount = substr($amount, 0, $pos);
            }

            // Extract last 3 from amount
            $result = substr($amount, -3);
            $amount = substr($amount, 0, -3);

            // Apply digits 2 by 2
            while (strlen($amount) > 0) {
                $result = substr($amount, -2).",".$result;
                $amount = substr($amount, 0, -2);
            }

            return $result.$decimals;
        }

        // Return western format
        return number_format(
            $this->amount,
            $this->currency->getPrecision(),
            $this->currency->getDecimalSeparator(),
            $this->currency->getThousandSeparator()
        );
    }
public function amount ( ) { // Indian Rupee use special format if ( $ this -> currency -> getCode ( ) == 'INR' ) { $ decimals = null ; $ amount = $ this -> amount ; // Extract decimals from amount if ( ( $ pos = strpos ( $ amount , "." ) ) !== false ) { $ decimals = substr ( round ( substr ( $ amount , $ pos ) , 2 ) , 1 ) ; $ amount = substr ( $ amount , 0 , $ pos ) ; } // Extract last 3 from amount $ result = substr ( $ amount , - 3 ) ; $ amount = substr ( $ amount , 0 , - 3 ) ; // Apply digits 2 by 2 while ( strlen ( $ amount ) > 0 ) { $ result = substr ( $ amount , - 2 ) . "," . $ result ; $ amount = substr ( $ amount , 0 , - 2 ) ; } return $ result . $ decimals ; } // Return western format return number_format ( $ this -> amount , $ this -> currency -> getPrecision ( ) , $ this -> currency -> getDecimalSeparator ( ) , $ this -> currency -> getThousandSeparator ( ) ) ; }
Get amount formatted to currency.

@return mixed
Get amount formatted to currency .