如何将我的值拆分为10位数

时间:2016-09-14 11:18:44

标签: php

我从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`

0 个答案:

没有答案