How can I insert text into a PHP string at a specific point without overwriting anything?
Use substr_replace () with a length value of 0.
CODE:
substr_replace("abcdefgh","-bbbb-",3,0);
The output above would be "abc-bbbb-defgh"
Simple, use substr() :
substr()
$str_a = "foo bar"; $str_b = substr($str_a, 0, 3) . ' baz' . substr($str_a, 3);