substr_replace():-

The substr_replace() function replaces a part of a string with another string.

code:-

<?php

$str1 = 'hello';
$str2 =' world';
$pos = 5;
$newstring = substr_replace($str1, $str2.' ', $pos, 0);
echo $newstring."\n";
?>

output:-

hello world

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post