I want to replace all "new line" characters with <br> so I can print my text HTML correctly ...

I do

$text = preg_replace("\n", "<br>", $text);

and I get this error:

Warning: Empty regular expression in /usr/local/www/virtual-sites/dinamo.online.ro/teste/log/add_art.php on line 9

Can you help?

    Errr try this:

    $test="Testing it\n again???";
    $test=preg_replace("/\n/", "<br>", $test);
    echo $test;
    

      You'd better try $test = nl2br($test);
      We got this function so we're supposed to use it 🙂

        Write a Reply...