add character after x characters in php
$newstr = substr_replace($oldstr, $str_to_insert, $pos, 0);
Here is what the above code is Doing:
1. It’s taking the string $oldstr and replacing it with the string $str_to_insert at the position $pos.
2. The third parameter is the number of characters to replace.
3. The fourth parameter is the string to replace with.