The best way to achieve that is to use a regex, as such : 
$string = preg_replace('#([0-9]*?)(7)([0-9]*?)(8)([0-9]*?)(6)([0-9]*?)#', '$1<span style="color: red;">$2</span>$3<span style="color: red;">$4</span>$5<span style="color: red;">$6</span>$7', $string);
This regex will match : 
- ([0-9]*?): zero or more numeric characters, not replacing them
- (7): the first occurence of- 7, replacing it with- <span style="color: red;">7</span>
- ([0-9]*?): zero or more numeric characters, not replacing them
- (8): the first occurence of- 8, replacing it with- <span style="color: red;">8</span>
- ([0-9]*?): zero or more numeric characters, not replacing them
- (6): the first occurence of- 6, replacing it with- <span style="color: red;">6</span>
- ([0-9]*?): zero or more numeric characters, not replacing them
If 7, 8 and 6 are not found in the string in that order, this will do nothing.
EDIT : Added ? for each [0-9]* in order to make the quantifier ungreedy (as explained here)