Last active
June 23, 2023 10:27
-
-
Save inuvalogic/5a915955a7614c2ee2f6debcce2035e5 to your computer and use it in GitHub Desktop.
replace 0 to 62 or other country code for whatsapp link wa.me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// replace 081234567890 or 6281234567890 or +6281234567890 or 62 812 34 567 890 | |
// to 6281234567890 for whatsapp link http://wa.me/62xxxxx | |
function phoneFormat($number, $country_code = '62') | |
{ | |
$number = str_replace('+', '', $number); | |
$number = str_replace(' ', '', $number); | |
$number = preg_replace('/^0/', $country_code, $number); | |
return $number; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment