You can use Heredoc to create css or js code and store it conveniently in variable. Heredoc can be used as a mini template engine.

In this example you can see that we are able to use php variables directly in Heredoc. PHP expands OR replaces the variable with variables content/value.

This feature of PHP gives us the ability to dynamically generate css/js code for your front end.

$color_font = '#000';
$color_bg = '#ddd';

$css_style = <<<END
  html { margin: 0px; }
  body { 
    margin: 0px;
    color: $color_font;
    background-color: $color_bg;
  }
END;

$head = '<head><style>' . $css_style . '</style></head>';

echo $head;

Output

<head><style>
  html { margin: 0px; }
  body { 
    margin: 0px;
    color: #000;
    background-color: #ddd;
  }
</style></head>

To learn more about Heredoc the PHP documentation