I have a log file that has ANSI colors. I use PHP to str_replace these into <span color=""> HTML tags.
If I use PHP str_replace, and parse color resets as </span>, how would I end more than one span declaration?
Example: <span color="red"><span color="blue"></span>
How could I make it so that one </span> ends both the previous statements?
You wouldn’t, you need to use two
</span></span>tags to close both<span>tags.For your case this would be
Note: As @calvinf pointed out in a comment below you should use
style="color:blue;"since thecolorattribute has been deprecated for a long time.