带有关联数组的PHP str_replace

I have a row returned from DB and i need to change the specific markup characters used in cols to the right characters for the display:

$row = mysqli_fetch_array($res, MYSQLI_ASSOC); //the result of query is 1 row

$markup = array("@", "#", "&", "$"); // this is our markup
$meaning   = array("↑", "↓", "(dil.)", "(conc.)"); // this is our meaning of the markup for the display

foreach ($row as $k => $v) { //for each element of the array we change one char for the other
$v = str_replace ($markup, $meaning, $v);
echo "<br>$v";

}

UPD now its getting more weird. I did a mistake by tracing if the str_replace before the change was made to array, i fixed it ant tracing shows that it works! But there is a specialised output of this array down below and it still appears with unreplaced characters!

    $reagent_no = "reaction_l" . $i; // determining the column number, irrelevant to the issue
    echo "<td>
<h3>{$row[$reagent_no]}</h3></td>"; //output of the supposedly 
//changed characters, but it still outputs the markup, as if i didnt do anything to the array previously

You are first printing the variable and then using the str_replace() function. Change it to:-

foreach ($row as $k => $v) { //for each element of the array we change one char for the other
$v = str_replace ($markup, $meaning, $v);
echo "<br>$v";
}

The problem is that the str_replace is executed after the echo.

Try:

foreach ($row as $k => $v) { //for each element of the array we change one char for the other
    $v = str_replace ($markup, $meaning, $v);
    echo "<br>$v";
}