i am trying to covert a word in to its number equivlent, on the following basis
on a keypad or texting on mobiles phones, each letter a-z is equal to a number 0-9, i would like to use the ereg_replace to covert a word in to the number.
I am using a link for each number, how ever is there a way to cut this down with just one line of coding using the ereg_repace???
$string="NEIL";
$string = ereg_replace("[A-C]", "2", $string);
$string = ereg_replace("[D-F]", "3", $string);
$string = ereg_replace("[G-I]", "4", $string);
$string = ereg_replace("[J-L]", "5", $string);
$string = ereg_replace("[M-O]", "6", $string);
$string = ereg_replace("[P-S]", "7", $string);
$string = ereg_replace("[T-V]", "8", $string);
$string = ereg_replace("[W-Z]", "9", $string);
echo $string;