PHP生成随机手机号

示例代码生成10个随机手机号

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$arr = array(
130,131,132,133,134,135,136,137,138,139,
144,147,
150,151,152,153,155,156,157,158,159,
165,166,
170,171,172,173,175,176,177,178,
180,181,182,183,184,185,186,187,188,189,
);
for($i = 0; $i < 10; $i++) {
$tmp[] = $arr[array_rand($arr)].mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9).mt_rand(0,9);
}
var_export(array_unique($tmp));
?>