Search code examples
phphtmlspecialcharsnl2br

Echo nlb2r htmlspecialchar


Want to use nl2br and htmlspecialchar. Right now result will say nl2br before the content.

     $contentfix = wordwrap($content, 100, "<br />\n", true);

     echo '<div style="color:white;font-size:20px;/*font-family:play ;">'.nl2br 
    ,htmlspecialchars ($contentfix, ENT_QUOTES).'</div> ';

Solution

  • Firstly: you can't call functions comma-seperated. Secondly: you have an unclosed multiline comment.

    Try this:

    $contentfix = wordwrap($content, 100, "<br />", true);
    echo '<div style="color:white; font-size:20px;">'. nl2br(htmlspecialchars($contentfix, ENT_QUOTES)) . '</div>';