nl2br
-
Adding a
<br />tag before each newline is accomplished in Ruby using string substitution withString#gsub.PHP
$result = nl2br("The quick\nbrown fox"); var_export($result); // => "The quick<br />\nbrown fox"
Ruby
p "The quick\nbrown fox".gsub("\n", "<br />\n") # => "The quick<br />\nbrown fox"
see also
Looking for Rails or PHP web application development, integration, and training?
Rails for PHP is brought to you by Maintainable Software. Get custom web applications and personalized training from the authors of the book and website.

