- preg_replace_callback: documentation ( source)
- str_replace: documentation ( source)
<?php
$str = "this is. an example. 15.68€";
function cleaner($matches)
{
return str_replace("." , "," , $matches["nrs"]);
}
$str = preg_replace_callback ("/(?P<nrs>[0-9]+.[0-9]+)/" , "cleaner" , $str);
echo $str;
?>