str_replace php variable code example
Example 1: str_replace php variable
$var1 = 'hello.world';
$var2 = str_replace(".", "-", $var1);
echo $var2; // hello-world
Example 2: str_replace php variable
$var1 = 'hello_john';
$var2 = str_replace("_", "-", $var1);
echo $var2; // hello-john