PHP str_replace() function - replace part of string from existing string


Syntax: str_replace("<replace from string>","<replace to string>","<source string>");
  
Replace the characters "I am" with "You are" from the sentence  "I am beautiful." 

<?php
echo str_replace("I","You","I am beautiful.");
?>


Output: You are beautiful.

1 comment :

essay on time said...

I have some issue in understanding the concept and it seems like that you have some good understanding of these. Please share some more detailed info on this.