0
$color="#FF0000";
$text = "Text";

I have this code but it has a syntax error.

echo '<div class="text"><span style=\color": $color\">$text</span",'</div>';

Whats wrong? I would like to echo the $text with $color color with "text" div class.

Bence
  • 97
  • 1
  • 8

1 Answers1

1

Try this:

echo '<div class="text"><span style="color:', $color, '">',$text,'</span></div>';