note 57071 deleted from function.preg-match by felipe

From: Date: Mon, 10 Dec 2007 01:42:32 +0000
Subject: note 57071 deleted from function.preg-match by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133074@lists.php.net to get a copy of this message
Note Submitter: tlex at NOSPAM dot psyko dot ro ---- To check a Romanian landline phone number, and to return "Bucharest", "Proper" or "Unknown", I've used this function: <? function verify_destination($destination) { $dst_length=strlen($destination); if ($dst_length=="10"){ if(preg_match("/^021[2-7]{1}[0-9]{6}$/",$destination)) { $destination_match="Bucharest"; } elseif (preg_match("/^02[3-6]{1}[0-9]{1}[1-7]{1}[0-9]{5}$/",$destination)) { $destination_match = "Proper"; } else { $destination_match = "Unknown"; } } return ($destination_match); } ?>

« previous php.notes (#133074) next »