我从database
获取所有手机号码并转换为字符串。接下来将我的手机号码分成10,10位数。
<?php
$query = mysql_query("select phone from reservation");
$array = array();
while($row = mysql_fetch_array($query)){
$test = $row['phone'];
$test_sp=(string)$test;//convert into string
$arr=str_split($test_sp, "10"); //break up into every 10digits
$new_test=implode(",",$arr);
echo $new_test;
}
?>
输出:
`994417626199441762619944176261`
期待输出:
`9944176261,9944176261,9944176261`