douruoshen1449 2013-07-25 09:41
浏览 26

PHP检查电话前缀

The code is kinda big so I want to avoid posting it here.
http://codepad.org/ARzh7ya9

What am trying to do is I load a bunch of numbers into an array. All these numbers have prefixes whereever they are local, mobile or shared.

$this->callArr contains numbers such as 46703920293:402 or 4629304921:94 (number:duration of call).
As you can see 4670 is one prefix and 46 is another. This may seem confusing at first but the later is a local call and the first is a mobile call.

What I am doing: for each number in callArr, first explode to seperate number and duration. Then remove the country code in this case 46 then only grab the first two numbers.
46703920293 would magically turn into 70 indicating it is an mobile number.

Then for each number go through the pricelist array $this->priceArr.
The priceArr have the following structure number:price:type:oa.

Example: 4670:0.65:mobile:0.15
The pricelist only contain the prefix. oa = opening costs for a call.

On line 27 I check if the length of the $number (which is the pricelist prefix) is == 2. If it is it's a 46 number which is local. If it's not then remove the 46(country code).

The issue is at line 41. He can find all mobile matches, all free cost and shared. But he have issues grabbing the local calls. Can anyone see what am doing wrong here?



A lot of text hope you bear with me!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示