i was working today then i got this idea. I want to make a script that take a plain text and then encrypt it with T9 mode for SMS messages on mobile phone.
plain text : Hello
Result : 4433555555666
So i created some class like this :
<?php
class decoder {
public $keys = array(
'2' => 'abc',
'3'=> 'def',
'4'=> 'ghi',
'5'=> 'jkl',
'6'=> 'mno',
'7'=> 'pqrs',
'8'=> 'tuv',
'9'=> 'wxyz',
'0'=> ' '
);
function key($string) {
// store every character from the string into an array
$str = str_split($string);
}
}
$deco = new decoder;
echo $deco->key('hello');
?>
the problem is i need some algorithms and lines on how i can compare every character from the given plain text with the keys array and then return a key number if there a match.