3 つの数字ごとに「-」を付けたいと思います。
例えば:
$number = 123456789;
私はそれを作りたいです123-456-789;
誰か助けてくれませんか?
ありがとう。
使用できますchunk_split():
$number = "123456789";
$phone = chunk_split($number,3,"-");
$phone = substr($phone, 0, -1);  // remove trailing hyphen
文字列を配列に分割し、次を使用して接着しますstr_split
$string = "12345678645465665646346";
 $arr = str_split($string, 3);
 $output = implode("-", $arr);
echo $output;