• 0

[PHP] - replace a enter with <br>


Question

4 answers to this question

Recommended Posts

  • 0
i've already tried that and it didn't work because i have code in it aswell

echo nl2br("

<div align='center'>

$post

</div>

");

all it does is display nothing on the page

if $post is a variable, then:

echo "&lt;div align='center'&gt;" . nl2br($post) . "&lt;/div&gt;";

or even better, there's no need to store the div in the variable, or even parse it with php - e.g:

&lt;div align="center"&gt;
&lt;?php echo nl2br($post); ?&gt;
&lt;/div&gt;

If that's not what you mean, pastebin the source and we'll have a look (**** any passwords out obviously).

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

  • Recent Achievements

    • One Year In
      Console General earned a badge
      One Year In
    • One Year In
      Twozo Technologies earned a badge
      One Year In
    • One Month Later
      Twozo Technologies earned a badge
      One Month Later
    • Week One Done
      Twozo Technologies earned a badge
      Week One Done
    • Veteran
      branfont went up a rank
      Veteran
  • Popular Contributors

    1. 1
      +primortal
      503
    2. 2
      +Edouard
      194
    3. 3
      PsYcHoKiLLa
      127
    4. 4
      Steven P.
      88
    5. 5
      neufuse
      71
  • Tell a friend

    Love Neowin? Tell a friend!