Skip to content

Instantly share code, notes, and snippets.

@berliozd
Created October 26, 2016 08:59
Show Gist options
  • Save berliozd/80931874ea8c9e87af9115d428511dd0 to your computer and use it in GitHub Desktop.
Save berliozd/80931874ea8c9e87af9115d428511dd0 to your computer and use it in GitHub Desktop.
<?php
/**
* Format phone number as 0111111111 (replace +33 or 33 by 0)
*
* @param $countryId
* @param $phone
* @return mixed
*/
protected function _formatPhone($countryId, $phone)
{
if ($countryId === 'FR') {
$phone = preg_replace('/^(\+?(00)?33)/', '0', $phone);
}
return $phone;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment