Constant Summary
CONSTANT NAMECONSTANT VALUEDESCRIPTION
N2T_BIG Serialize(Array) Serialized Array of big names, thousand, million, etc
N2T_MEDIUM Serialize(Array) Serialized Array of medium names, twenty, thirty, etc
N2T_SMALL Serialize(Array) Serialized Array of small names, zero, one, etc.. up to eighteen, nineteen
N2T_DOLLARS dollars Word for "dollars"
N2T_DOLLARS_ONE dollar Word for one "dollar"
N2T_CENTS cents Word for "cents"
N2T_CENTS_ONE cent Word for one "cent"
N2T_AND and Word for "and"


Function Summary
NumberToText ( $number, [$currency = false], [$capatalize = false], [$and = true] )
Number to text converter. Converts a number into a textual description, such as "one hundred thousand and twenty-five".

Now supports _any_ size number, and negative numbers. To pass numbers > 2 ^32, you must pass them as a string, as PHP only has 32-bit integers.
n2t_convertthree ( $number, $and, $preceding )
This is a utility function of n2t. It converts a 3-digit number into a textual description. Normally this is not called by itself.

Constant Detail

N2T_SMALL

N2T_BIG = ->serialize(array('thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', 'sextillion', 'septillion', 'octillion', 'nonillion', 'decillion', 'undecillion', 'duodecillion', 'tredecillion', 'quattuordecillion', 'quindecillion', 'sexdecillion', 'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion'))<-

Serialized Array of big names, thousand, million, etc
 

  • Package
  • NumberToText

    N2T_MEDIUM

    N2T_MEDIUM = ->serialize(array(2=>'twenty', 3=>'thirty', 4=>'fourty', 5=>'fifty', 6=>'sixty', 7=>'seventy', 8=>'eighty', 9=>'ninety'))<-

    Serialized Array of medium names, twenty, thirty, etc
     
    
    
  • Package
  • NumberToText

    N2T_SMALL

    N2T_SMALL = ->serialize(array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'seventeen', 'eighteen', 'nineteen'))<-

    Serialized Array of small names, zero, one, etc.. up to eighteen, nineteen
     
    
    
  • Package
  • NumberToText

    N2T_DOLLARS

    N2T_DOLLARS = ->dollars<-

    Word for "dollars"
     
    
    
  • Package
  • NumberToText

    N2T_DOLLARS_ONE

    N2T_DOLLARS_ONE = ->dollar<-

    Word for one "dollar"
     
    
    
  • Package
  • NumberToText

    N2T_CENTS

    N2T_CENTS = ->cents<-

    Word for "cents"
     
    
    
  • Package
  • NumberToText

    N2T_CENTS_ONE

    N2T_CENTS_ONE = ->cent<-

    Word for one "cent"
     
    
    
  • Package
  • NumberToText

    N2T_AND

    N2T_AND = ->and<-

    Word for "and"
     
    
    
  • Package
  • NumberToText


    Function Detail

    NumberToText

    NumberToText ( $number, [$currency = false], [$capatalize = false], [$and = true] )
    Number to text converter. Converts a number into a textual description, such as "one hundred thousand and twenty-five".

    Now supports _any_ size number, and negative numbers. To pass numbers > 2 ^32, you must pass them as a string, as PHP only has 32-bit integers.
     
    Function Parameters:
  • $number
  • int The number to convert
  • $currency
  • bool True to convert as a dollar amount
  • $capatalize
  • bool True to capatalize every word (except "and")
  • $and
  • bool True to use "and" (ie. "one hundred AND six")
    Function Info:
  • Author
  • Greg MacLellan
  • Version
  • 1.1
  • Return
  • The textual description of the number, as a string.
  • Package
  • NumberToText

    n2t_convertthree

    n2t_convertthree ( $number, $and, $preceding )
    This is a utility function of n2t. It converts a 3-digit number into a textual description. Normally this is not called by itself.
     
    Function Parameters:
  • $number
  • int The 3-digit number to convert (0 - 999)
  • $and
  • bool True to put the "and" in the string
  • $preceding
  • bool True if there are preceding members, puts an explicit and in (ie 1001 => one thousand AND one)
    Function Info:
  • Return
  • The textual description of the number, as a string
  • Package
  • NumberToText