Formating output to a web page in its original format --no concatenation--

I have four (4) separate lines in a fortunes files that output just fine using the ‘fortunes’ on the cli. However, my current issue is, when calling ‘fortunes’ with this:

$sString = shell_exec($fortune_command);

Thereafter outputting the results on a web page with this:

echo $sString;

The four (4) separate lines, from within the fortunes file(s), are joined together as one (1) line. How can we maintain the original formatting on the web page to eliminate the concatenation? I am not a coder; please go slow with the terms used in your response.


You can try this:

[php]echo nl2br($sString);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service