Echo line break from variable in textarea (and fpdf)
<p>In my database I've </p>

<pre><code>Linetext1 \r\nLinetext2
</code></pre>

<p>I then fech data:</p>

<pre><code>while($row = $result-&gt;fetch_assoc()) {
   $mydata_array = $row['myrow'];
}
</code></pre>

<p>then the echo part:</p>

<pre><code>for ($i = 0; $i &lt;5; ++$I){
     echo $mydata_array[$i];
}
</code></pre>

<p>But it literally output in textarea (and in fpdf) Linetext1 \r\nLinetext2. I did try a string replace as suggested in other questions</p>

<pre><code>echo (str_replace('\r\n', '&lt;br /&gt;', $mydata_array[$i]);
</code></pre>

<p>but then I literally have </p>

<pre><code>Linetext1 &lt;br /&gt;Linetext2
</code></pre>

<p>Thanks for your help!</p>

<p><strong>SOLUTION</strong></p>

<p>After Sergey's answer, I used this:</p>

<pre><code>echo (str_replace(array('\r', '\n'), array("", "\n"), $mydata_array[$i]);
</code></pre>

<p>PS It's important to use MultiCell and not single Cell</p>