Is it possible to replace semicolon and ampersand to her HTML entity on the same time?
$string = "one & two; three & four; end";
$result = preg_replace('/\;|\&/',";|&",$string);
echo $result;
// one ;|& two;|& three ;|& four;|& end
preg_replace with array dont solved it.
$string = "one & two; three & four; end";
$pattern = array("/\;/","/\&/");
$replace = array(";","&");
$result = preg_replace($pattern,$replace,$string);
echo $result;
// ne & two; three & four; end
Questions and answers with "preg_replace" dont solved it. "strtr" with an array solved it only. https://www.php.net/manual/de/function.strtr.php