I have this loop:
for ($m=0; $m<7; $m++){
if ($myextra[$m] == $drawextra[$m]) {
$myextra[$m] = '<span class="matchx">'.$myextra[$m].'</span>';
}
}
echo $myextra;
My echo output is as follows:
3445<<8
<11<<6<
<45<<<<
The class in the is from my stylesheet and should color the matched character in the string but the matched character is simply replaced by ‘<‘. They are in the correct position but how can I assign that class properly?
You cannot use [] notation to change more than one char in string.
You have to use new variable: