Replace a character in a String PHP
This functions replaces all the character in a string to a new character set by the user. So if the string contains 10 character `a` in a string and the users wants to replace it with `b` so all the letter `a` in the string will now then be letter `b’.
So to use that function.
<?php
$source="car cat nap snap park apple bag pants lap tap";
$sample=str_replace("a","b",$source);
echo $sample;;
?>
This code will display
cbr cbt nbp snbp pbrk bpple bbg pbnts lbp tbp







