Quick Search:
Oracle PL/SQL Code Library
Find Or Post Oracle Jobs
Oracle Discussion & Chat
 PHP Code: Format money as millions, billions, etc Jump to:  
Category: >> PHP Code >> Format money as millions, billions, etc Bookmark and Share

<< lastnext >>

Snippet Name: Format money as millions, billions, etc

Description: This function formats a money amount into an abbreviated form. It takes a number like "1,246,743" and formats it as "1.25 million", (or billion, trillion, etc.)

Also see:
» Format money as millions, billions, et...
» BR2NL Function - Opposite of NL2BR
» Neatly trim a string to a set number o...
» Convert UK Dates To mySQL Format Dates
» Output mySQL data in columns
» SQL*Plus Display commands
» Create string by formatting an amount ...
» Date Functions: ROUND
» Display and release DBMS_LOCK locks
» Display locks and latches
» Display database SGA statistics
» Extract and Display all links on a web...
» Currency display formatting function
» Display stock quotes from a CSV file
» Display html source with line numbers
» Rounded random numbers
» Date Functions: Round (date)
» Number Functions: Round to n
» Number Functions: Round to integer

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: June 27th, 2010

FUNCTION format_cash($cash) {
    // strip any commas 
    $cash = (0 + STR_REPLACE(',', '', $cash));
    // make sure it's a number...
    // filter and format it 
		RETURN ROUND(($cash/1000000000000),2).' trillion';
		RETURN ROUND(($cash/1000000000),2).' billion';
		RETURN ROUND(($cash/1000000),2).' million';
		RETURN ROUND(($cash/1000),2).' thousand';

Oracle Magazine
and Oracle White Papers

SQL University.net courses meet the most demanding needs of the business world for advanced education in a cost-effective manner. SQL University.net courses are available immediately for IT professionals and can be taken without disruption of your workplace schedule or processes.

Compared to traditional travel-based training, SQL University.net saves time and valuable corporate resources, allowing companies to do more with less. That's our mission, and that's what we deliver.

Click here to find out more
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 23 users online    © 2009 psoug.org

Forgot your password?