Add space after every 4th character

前端 未结 8 1882
我寻月下人不归
我寻月下人不归 2021-02-11 12:19

I want to add a space to some output after every 4th character until the end of the string. I tried:

$str = $rows[\'value\'];


        
8条回答
  •  醉酒成梦
    2021-02-11 12:28

    Have you already seen this function called wordwrap? http://us2.php.net/manual/en/function.wordwrap.php

    Here is a solution. Works right out of the box like this.

    
    

提交回复
热议问题