Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
check indonesia provider by phone number
<?php
$providerList = [
"telkomsel" => [
"0811",
"0812",
"0813",
"0821",
"0822",
"0823",
"0852",
"0853",
"0851"
],
"indosat" => [
"0814",
"0815",
"0816",
"0855",
"0856",
"0857",
"0858",
],
"xl" => [
"0817",
"0818",
"0819",
"0859",
"0877",
"0878",
],
"three" => [
"0895",
"0896",
"0897",
"0898",
"0899",
],
"axis" => [
"0838",
"0831",
"0832",
"0833",
]
];
$myNumber = "08336727337";
$result = null;
foreach ($providerList as $key => $value) {
foreach ($value as $key2 => $value2) {
if (preg_match("/^{$value2}.*/", $myNumber))
{
$result = $key;
break;
}
}
}
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.