Tango.info base20: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<code> function tif_num2consonants($number, $frombase=10 , $tobase=20){ $r=base_convert ($number, $frombase , $tobase ); $r=str_split($r); //no vowel, no l $rep=array( 0=>...") |
m (moved tango.info base20 to Tango.info base20) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | consonants only, omitting "l" | ||
<pre> | |||
function tif_num2consonants($number, $frombase=10 , $tobase=20){ | function tif_num2consonants($number, $frombase=10 , $tobase=20){ | ||
//convert to base 20 | |||
$r=base_convert ($number, $frombase , $tobase ); | $r=base_convert ($number, $frombase , $tobase ); | ||
//no vowel, no l | //convert 0-j to b-z, no vowel, no l | ||
$ | $char_0j_to_bz=array( | ||
0=>"b",1=>"c",2=>"d",3=>"f",4=>"g", | 0=>"b", | ||
5=>"h",6=>"j",7=>"k",8=>"m",9=>"n", | 1=>"c", | ||
2=>"d", | |||
3=>"f", | |||
4=>"g", | |||
5=>"h", | |||
6=>"j", | |||
7=>"k", | |||
8=>"m", | |||
9=>"n", | |||
"a"=>"p", | "a"=>"p", | ||
"b"=>"q", | "b"=>"q", | ||
Line 19: | Line 28: | ||
"j"=>"z" | "j"=>"z" | ||
); | ); | ||
$r=str_split($r); | |||
$r_new=array(); | $r_new=array(); | ||
foreach ($r as $k =>$v){ | foreach ($r as $k =>$v){ | ||
$v_new=$ | $v_new=$char_0j_to_bz[$v]; | ||
$r_new[$k]=$v_new; | $r_new[$k]=$v_new; | ||
} | } | ||
Line 30: | Line 40: | ||
return $r_new; | return $r_new; | ||
} | } | ||
</ | </pre> |
Latest revision as of 2013-06-13T01:33:39
consonants only, omitting "l"
function tif_num2consonants($number, $frombase=10 , $tobase=20){ //convert to base 20 $r=base_convert ($number, $frombase , $tobase ); //convert 0-j to b-z, no vowel, no l $char_0j_to_bz=array( 0=>"b", 1=>"c", 2=>"d", 3=>"f", 4=>"g", 5=>"h", 6=>"j", 7=>"k", 8=>"m", 9=>"n", "a"=>"p", "b"=>"q", "c"=>"r", "d"=>"s", "e"=>"t", "f"=>"v", "g"=>"w", "h"=>"x", "i"=>"y", "j"=>"z" ); $r=str_split($r); $r_new=array(); foreach ($r as $k =>$v){ $v_new=$char_0j_to_bz[$v]; $r_new[$k]=$v_new; } $r_new=implode($r_new); //$tmp=array_flip($tmp); return $r_new; }