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 :

Post a Comment

Leave A Comment...