Snippets

# Numeric number to literal number

**Version:*** adjusted *

**Type:** Function

**Category:** Other

**License:** GNU General Public License

**Description:** Use to convert a numeric number to a literal string equivalent.
ie: numToString(10) returns "ten".
As of right now, it works for any number up
to 999,999,999,999,999,999,999,999.999999999 - if you need more than that, add to the $places array.

// just replace the arrays with the ones below for UK numbers and thirteen. // Explanation for US citizens about number formats. // unicycle has one wheel, a bicycle has two wheels (bi means 2 and tri=3,quad=4 etc.) // a million has 6 zeros, a billion is bi (which is 2) million, so 2 sets of a millions, which is 2 sets of 6 zeros, which is 12 zeros. 1,000,000,000,000. // therefore a trillion has 18 zeros, quadrillion 24 zeros. // The sets of numbers in between the comma seperators (3 zeros) is 1,000 which gives 1,000,000,000 a thousand million, which is called a billion in the US. $places = array ( "0" => "", "1" => "thousand", "2" => "million", "3" => "thousand million", "4" => "billion", "5" => "thousand billion", "6" => "trillion", "7" => "thousand trillion" "8" => "quadrillion", "9" => "thousand quadrillion" ); $tens = array ( "1" => "teen", "2" => "twenty", "3" => "thirty", "4" => "forty", "5" => "fifty", "6" => "sixty", "7" => "seventy", "8" => "eighty", "9" => "ninety" ); $odds = array ( "10" => "ten", "11" => "eleven", "12" => "twelve" "13" => "thirteen" );