You can explode by the slash by one way.
$exploded_text = explode("https://stackoverflow.com/", $text);
$new_text = $exploded_text[0] . $exploded_text[1] . 'p' . $exploded_text[2];
It’s not the best way, but it will work.
4
solved Add a text in a string PHP