进攻参考
public function telpohone($varibale)
{
// $telp = '';// var_dump($varibale);
$tel ['移动'] =
[
'134','135','136','137','138','139','147','150','151','152','157','158','159','172','178','182','183','184','187','188','198'
];
$tel ['联通'] =
[
'130','131','132','145','155','156','166','171','175','176','185','186'
];
$tel ['电信'] =
[
'133','149','153','173','177','180','181','189','199'
];
//以键值对形式遍历二维数组,再将值与传入参数做比较,最后返回对应的键
foreach ($tel as $telp => $value)
{ foreach ($value as $val)
{
if(stristr($val, $varibale))
// var_dump($telp);
return $telp;
}
}
return '';
}
public function telpohone($varibale)
{
// $telp = '';// var_dump($varibale);
$tel ['移动'] =
[
'134','135','136','137','138','139','147','150','151','152','157','158','159','172','178','182','183','184','187','188','198'
];
$tel ['联通'] =
[
'130','131','132','145','155','156','166','171','175','176','185','186'
];
$tel ['电信'] =
[
'133','149','153','173','177','180','181','189','199'
];
//以键值对形式遍历二维数组,再将值与传入参数做比较,最后返回对应的键
foreach ($tel as $telp => $value)
{ foreach ($value as $val)
{
if(stristr($val, $varibale))
// var_dump($telp);
return $telp;
}
}
return '';
}