
AH - yes of course.. Sometimes the most simple solutions are just too obvious to be seen - Thanks (maybe its time to stop coding for the day - clearly my mind is not sharp) code: $phone = '254' . substr(preg_replace('/[^0-9]*/', '', $input), -9); .. Mike On 7/24/11 11:13 PM, Rad! wrote:
Personally I am a student of Occam's razor.
A mobile number (in Kenya at any rate) Is composed of 9 digits (barring the zero and/or country code)
So a regex that removes all non digits from a given number and then captures 9 digits from the end of line should work consistently.
You can then add the leading 0 or the country prefix in code
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke