Return to Snippet

Revision: 32021
at September 17, 2010 12:47 by traeregan


Initial Code
private function _remove_non_numeric($string) {
		return preg_replace('/\D/', '', $string);
	}
	
	private function _clean_phone_number($phone_number)
	{
		$CI = &get_instance();
		
		$phone_number = $CI->_remove_non_numeric($phone_number);
		
			if((strlen($phone_number) >= 11) AND ($phone_number[0] == '1'))
			{
				$string = substr($phone_number, 1);
			}
		
		return $phone_number;
	}

Initial URL

                                

Initial Description

                                

Initial Title
Clean 10 Digit Phone Number

Initial Tags
php, codeigniter

Initial Language
PHP