One of the fields in our PHP page is a description. Occasionally there are line spaces included to indicate a new paragraph. However, when pulling this data from the database table the text is rendered in one block without the spaces. How can I parse text from database table with the line-space in the final rendered PHP page? Thanks!
This is the part of the code that pulls the text from the database, which includes a function to parse anything beginning with http:// as a clickable link:
NB: $det[9] is the text
<?php
echo preg_replace_callback(
'/http:\/\/([,\%\w.\-_\/\?\=\+\&\~\#\$]+)/',
create_function(
'$matches',
'return \'<a href="http://\'. $matches[1] .\'">\'. $matches[1] .\'</a>\';'
),
$det[9]
);
?>
I think u search this function nl2br
The above example will output: