PHP By Supplying No Start Or Length Arguments, String Will Be Added To Beginning – String Function

<?php  $mystring = substr_replace("Hello World", "H3110 W0r1d!", 0, 0);
  echo $mystring . "<br />"; //Echos H3110 W0r1d!Hello World
 
  $mystring = substr_replace("Hello World", "0 w0", 4, 4);
  echo $mystring; //Echos Hell0 w0rld.
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.