PHP Classes

Num2Txt: Convert a number to Spanish text

Recommend this page to a friend!
  Info   View files Documentation   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 87 All time: 9,987 This week: 78Up
Version License PHP version Categories
num2txt 1.0.1The PHP License5PHP 5, Text processing, Math


This package is specific mainly for applications used in Spain Spain .

This class can convert a number to Spanish text.

It can take a number and returns a text string that spells the number with words in Spanish.

The class can spell a number of less than 1,000,000,000,000 .

Picture of Antonio Leiva
  Performance   Level  
Name: Antonio Leiva <contact>
Classes: 2 packages by
Country: Spain Spain
Age: 53
All time rank: 3777101 in Spain Spain
Week rank: 307 Up10 in Spain Spain Up



Two simple classes for convert a number to spanish text.



string txt1 = Alp3476.A2Num2Txt.ToString("3528.25");
// tres mil quinientos veintiocho con veinticinco

string txt2 = Alp3476.A2Num2Txt.ToString(123456);
// ciento veintitres mil cuatrocientos cincuenta y seis

string txt3 = Alp3476.A2Num2Txt.ToString(-258241.2);
// menos doscientos cincuenta y ocho mil doscientos cuarenta y uno con veinte


include 'Num2Txt.php';

$o = new  \Alp3476\Num2Txt();
echo $o->toString(3527.25) . PHP_EOL;
// tres mil quinientos veintisiete con veinticinco

echo $o->toString(12342245281.890) . PHP_EOL;
// doce mil trescientos cuarenta y dos millones doscientos cuarenta y cinco mil doscientos ochenta y uno con ochenta y nueve

echo $o->toString(0.253) . PHP_EOL;
// cero con veinticinco


Trim decimals to 2 digits

  Files folder image Files  
File Role Description
Files folder imagec-sharp (1 file)
Files folder imagephp (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  c-sharp  
File Role Description
  Accessible without login Plain text file Num2Txt.cs Data Auxiliary data

  Files folder image Files  /  php  
File Role Description
  Plain text file Num2Txt.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,987
This week:78Up