This is the program:
$string = 'Inquiry {{inquiry:number}} is assigned to {{details_1}}';
$patterns = array();
$patterns[0] = '/({{)(.*)(}})/U';
$patterns[1] = '/({{)(.*)(}})/U';
$replacements = array();
$replacements[1] = 15;
$replacements[0] = 20;
ksort($patterns);
ksort($replacements);
echo preg_replace($patterns, $replacements, $string);
It should give the output:
Inquiry 20 is assigned to 15
But what I am getting:
Inquiry 20 is assigned to 20
I was wondering is it a problem with preg_replace?
Note: I am trying to replace the string inside {{ .. }} including the curly brackets, with the corresponding values.