Version: 1.0 (nl)
Type: Function
Category: Money
License: GNU General Public License
Description: This function writes-out a number from 0 to 999999999. Example: 14104 will return ‘veertienduizendhonderdvier’. Now only available in Dutch, English will follow
<?php function saynumber($number){ $number = (int) $number; $name[0] = "nul"; $name[1] = "een"; $name[2] = "twee"; $name[3] = "drie"; $name[4] = "vier"; $name[5] = "vijf"; $name[6] = "zes"; $name[7] = "zeven"; $name[8] = "acht"; $name[9] = "negen"; $name[10] = "tien"; $name[11] = "elf"; $name[12] = "twaalf"; $name[13] = "dertien"; $name[14] = "veertien"; $name[20] = "twintig"; $name[30] = "dertig"; $name[40] = "veertig"; $name[50] = "vijftig"; $name[60] = "zestig"; $name[70] = "zeventig"; $name[80] = "tachtig"; $name[90] = "negentig"; $name[100] = "honderd"; $name[1000] = "duizend"; $name[1000000] = "miljoen"; if(isset($name[$number])){ return $name[$number]; }else{ if($number>14&&$number< 20){ return $name[substr($number,-1)].$name[10]; }elseif($number>20&&$number< 100){ return $name[substr($number,-1)]."en".$name[substr($number,-2,-1)."0"]; }elseif($number>100&&$number<200){ return $name[100].saynumber(substr($number,-2)); }elseif($number>199&&$number<1000){ $string = $name[substr($number,-4,-2)].$name[100]; if(substr($number,-2)!="0"&&substr($number,-2)!="00") $string.= saynumber(substr($number,-2)); return $string; }elseif($number>1000&&$number<10000){ $string = ""; if(substr($number,-3,-2)==0){ if(substr($number,-6,-3)>1){ $string .= saynumber(substr($number,-6,-3)); } $string.= $name[1000]; }else{ $string = saynumber(substr($number,-6,-2)); $string.= $name[100]; } if(substr($number,-2)>0) $string .= saynumber(substr($number,-2)); return $string; }elseif($number>9999&&$number<1000000){ $string = ""; if(substr($number,-3,-2)==0){ //gehele duizendtallen (23-duizend,2-duizend) if(substr($number,-6,-3)>1){ $string .= saynumber(substr($number,-6,-3)); } $string.= $name[1000]; }else{ $string = saynumber(substr($number,-6,-3)); if($number>10000) $string.= $name[1000]; } if(substr($number,-3)>0) $string .= saynumber(substr($number,-3)); return $string; }elseif($number>1000000&&$number<1000000000){ return saynumber(substr($number,-9,-6))."".$name[1000000]." ".saynumber(substr($number,-6)); } } } ?>