PHP substr_replace() Function

The substr_replace() function is used to replace part of a string with another string or words.

Demo :



Text  Replace Text
Repl Position    

Example :

Type sentance at textarea like this php is a programming language and also type replace text box like this powerful language. Then you type Replace Position number like this 9.Then click Replace button finally you get output this php is a powerful language.


<?php
  $originalString = "php is a programming language";
  $replaceString = "powerful language";
  $result = substr_replace($originalString,$replaceString,9);
  echo $result;
?>

In the above code is used to replace part of a string with another.In the substr_replace() function have four parameters that name is string str,string repl,int start,[int length].

Free Download Script :

If you need substr_replace() function demo code download from following link.

Download




Content