I've the following code:
$formula = "E1 + E2 + E4 + E5 + E7 + E8 + E10 + E11";
$patterns = array('Se' => '@Se@',
'Et' => '@Et@',
'E1' => '@E1@',
'E2' => '@E2@');
$values = array('Se' => 9,
'Et' => 12,
'E1' => 1,
'E2' => 8);
$replaced = preg_replace($patterns, $values, $formula);
echo $replaced;
"1 + 8 + E4 + E5 + E7 + E8 + 10 + 11"
I need a code that only replace E1, and ignore E10 and E11, in this case showing the following result: "1 + 8 + E4 + E5 + E7 + E8 + E10 + E11"
thanks!