📜  php 在字符串的空格中插入连字符 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:31.853000             🧑  作者: Mango

代码示例1
$test = "jjfnj 948";
$test = str_replace(" ", "", $test);  // strip all spaces from string
echo substr($test, 0, 3)."-".substr($test, 3);  // isolate first three chars, add hyphen, and concat all characters after the first three