Código PHP:
Ver originalif ((int)$ent === 0) return 'Cero ' . $fin;
$tex = '';
$sub = 0;
$mils = 0;
$neutro = false;
while ( ($num = substr($ent, -3)) != ' ') {
if (++$sub < 3 and $fem) {
$matuni[1] = 'uno';
$subcent = 'as';
}else{
$matuni[1] = $neutro ? 'un' : 'uno';
$subcent = 'os';
}
$t = '';
if ($n2 == '00') {
}elseif ($n2 < 21)
$t = ' ' . $matuni[(int)$n2];
elseif ($n2 < 30) {
$n3 = $num[2];
if ($n3 != 0) $t = 'i' . $matuni[$n3];
$n2 = $num[1];
$t = ' ' . $matdec[$n2] . $t;
}else{
$n3 = $num[2];
if ($n3 != 0) $t = ' y ' . $matuni[$n3];
$n2 = $num[1];
$t = ' ' . $matdec[$n2] . $t;
}
$n = $num[0];
if ($n == 1) {
$t = ' ciento' . $t;
}elseif ($n == 5){
$t = ' ' . $matunisub[$n] . 'ient' . $subcent . $t;
}elseif ($n != 0){
$t = ' ' . $matunisub[$n] . 'cient' . $subcent . $t;
}
if ($sub == 1) {
}elseif (! isset($matsub[$sub])) { if ($num == 1) {
$t = ' mil';
}elseif ($num > 1){
$t .= ' mil';
}
}elseif ($num == 1) {
$t .= ' ' . $matsub[$sub] . 'ón';
}elseif ($num > 1){
$t .= ' ' . $matsub[$sub] . 'ones';
}
if ($num == '000') $mils ++;
elseif ($mils != 0) {
if (isset($matmil[$sub])) $t .= ' ' . $matmil[$sub]; $mils = 0;
}
$neutro = true;
$tex = $t . $tex;
}
$tex = $neg . substr($tex, 1) . $fin; }
?>