I want to echo mysql data from a TEXT column, and preserve the breaks. I’m using <pre> to do this, but this then ignores the style="word-break:break-word;"
pseudo example:
<?php echo '<pre>'; ?>
<div style="width: 100px; word-break:break-word">
LonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglong
LonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglongLonglonglong
</div>
<?php echo '</pre>'; ?>
(the text inside the div is pulled from mysql)
break-word; in this example will have no effect, because the text is wrapped with <pre> tags. How can I preserve the line breaks of the original text, but induce a word break when I display it?
use the nl2br function. It will add
<br/>tags when new lines sould be.