I have a string like this:
$str = "This product price is 23,39 and sale end after 29th June";
I need to replace two characters after "," with ".-", so the output like:
This product price is 23.- and sale end after 29th June
I tried with but it remove last 3 characters:
echo substr($string, 0, strlen($string) - 3);
Please help me to solve this issue.
substr. Withsubstryou'll need to find the first occurance and use that in place of the0. e.g.strpos.$stringis not$str,.