php - base_convert numbers map to letters -
how can use base_convert map numbers letters?
for example 123456 become abcdef. number 123321 become abccba
i have unique number, needs keep it's uniqueness in form of string of letters. way this?
base_convert() converting numbers between different number systems. hex bin.
for task strtr():
$original = '13421'; $replaced = strtr($original, '12345', 'abcde'); echo $replaced; // output: acdba as see strtr works char-wise translator. if char out of $from string found in input string, translated char @ same position of $to string. however, it's better explained code example above :)
Comments
Post a Comment