PHP str_replace - find and replace part of a string

basic usage for the str_replace php function

str_replace ( mixed $search , mixed $replace , mixed $subject)

PHP

$string = "hi there i am a string";
$to_find = "a string";
$to_replace = "a replaced string";
$result = str_replace ( $search = $to_find , $replace = $to_replace , $subject = $string);
echo $result;

Demo

hi there i am a replaced string
Welcome

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.

❤👩‍💻🕹