What is the potential issue with using echo within a function for generating CSS code in PHP?

Using echo within a function for generating CSS code in PHP can make the code harder to read and maintain. It is recommended to separate the HTML and CSS code by storing the CSS rules in a separate variable and then echoing it outside the function. This approach helps in keeping the code organized and makes it easier to make changes to the CSS rules in the future.

function generate_css() {
    $css = "
    .class {
        color: red;
        font-size: 16px;
    }
    ";
    
    return $css;
}

echo "<style>" . generate_css() . "</style>";