I would like to do some simple replacement using php.
For the first occurrence of "xampp" , replace it as "xp".
For the second / last occurrence of "xampp", replace it as "rrrr"
$test = "http://localhost/xampp/splash/xampp/.php";
echo $test."<br>";
$count = 0;
$test = str_replace ("xampp","xp",$test,$count);
echo $test."<br>";
$count = 1;
$test = str_replace ("xampp","rrrr",$test,$count);
echo $test;
After looking the doc, I found that $count is to return the place where the string matchs only. It do not replace the string by specific occurrence assigned. So are there any ways to do the task?