How can the color be removed from highlighted PHP code?

To remove the color from highlighted PHP code, you can simply remove the HTML tags that are responsible for applying the color styling. This can be done by using a regular expression to strip out any <span> tags with style attributes.

$highlightedCode = &#039;&lt;span style=&quot;color: #ff0000;&quot;&gt;$variable&lt;/span&gt;&#039;;
$cleanedCode = preg_replace(&#039;/&lt;span style=&quot;color: #[a-fA-F0-9]{6};&quot;&gt;/&#039;, &#039;&#039;, $highlightedCode);
$cleanedCode = str_replace(&#039;&lt;/span&gt;&#039;, &#039;&#039;, $cleanedCode);

echo $cleanedCode;