Skip to content

Instantly share code, notes, and snippets.

@imduffy15
Created December 26, 2012 02:21
Show Gist options
  • Save imduffy15/4377342 to your computer and use it in GitHub Desktop.
Save imduffy15/4377342 to your computer and use it in GitHub Desktop.
Extract mobile numbers
foreach($vCard as $vCardPart) {
if(isset($vCardPart->n[0]['FirstName']) && isset($vCardPart->tel[0]['Value'])) {
$number = $vCardPart->tel[0]['Value'];
$number = str_replace("-","",$number);
$number = str_replace("00353","0",$number);
$number = str_replace("+353","0",$number);
if(
substr($number,0,3) == "086" ||
substr($number,0,3) == "087" ||
substr($number,0,3) == "083" ||
substr($number,0,3) == "085" ||
substr($number,0,3) == "089"
) {
$firstname = $vCardPart->n[0]['FirstName'];
echo($firstname . ": ");
echo($number);
echo("\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment