I want to repalce an array with a new one but only the first string is replaced. The new array is from a mysql table so I cant specify the exact strings.
$str = "##Random Stirng## ..... ##Random Stirng##";
$pattern = array ("str1" => "first replacement", "str2" => "second replacement");
$replacement = array('/##[^#]+##/','/##[^#]+##/');
echo preg_replace($replacement, $pattern, $str);
I want to replace the first IP-Address with the first replacement and the secon IP-address with the second replacement but instead both IP-Addresses are replaced with the first replacement.
"str2" => "second replacementmissingdouble quotesat the end