Code Monkey home page Code Monkey logo

number-to-words's Introduction

number-to-words

Build Status codecov Version Total Downloads Minimum PHP Version License

Convert numbers to words in English or German.

Install via Composer

$ composer require patrickschur/number-to-words

How to use

English

use NumberToWords\NumberToWords;
use NumberToWords\Locale\English;
 
$c = new NumberToWords(new English()); // english
 
// One followed by 3003 zeros
echo $c->nameOfLargeNumber(3003); // outputs "millinillion"
 
echo $n->convert('3043.43'); // outputs "three thousand forty-three point four three"
echo $n->convert('3.1415926535'); // outputs "three point one four one five nine two six five three five"

German

use NumberToWords\NumberToWords;
use NumberToWords\Locale\German;
 
$c = new NumberToWords(new German()); // german
 
// Eine Eins gefolgt von 6000 Nullen
echo $c->nameOfLargeNumber(6000); // outputs "Millinillion"
 
// Eine Eins gefolgt von 59994 Nullen
echo $c->nameOfLargeNumber(59994); // outputs "Nonillinovenonagintanongentillion"
 
echo $n->convert('509324'); // outputs "fünfhundertneuntausenddreihundertvierundzwanzig"
echo $n->convert('3,1415926535'); // outputs "drei Komma eins vier eins fünf neun zwei sechs fünf drei fünf"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.