Mutley Posted August 31, 2006 Share Posted August 31, 2006 Hi there, I'm trying to use nl2br to force text to a next line, how do I use it in this instance though?<?=$row['location']?>I tried with no luck this:<?=nl2br($row['location'])?>Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/19236-nl2br-help-where-to-use/ Share on other sites More sharing options...
Orio Posted August 31, 2006 Share Posted August 31, 2006 Instead of using the short way "<?=", try using echo().<?phpecho(nl2br($row['location']));?>Orio. Quote Link to comment https://forums.phpfreaks.com/topic/19236-nl2br-help-where-to-use/#findComment-83309 Share on other sites More sharing options...
Daniel0 Posted August 31, 2006 Share Posted August 31, 2006 You should generally always use <?php instead of <?, at least if you are going to publish it, since you can't except that all users support the latter one. Quote Link to comment https://forums.phpfreaks.com/topic/19236-nl2br-help-where-to-use/#findComment-83312 Share on other sites More sharing options...
Jenk Posted August 31, 2006 Share Posted August 31, 2006 echo is language construct, not a function, thus you shouldn't use parenthesis.[code]<?phpecho nl2br($row['location']);?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19236-nl2br-help-where-to-use/#findComment-83316 Share on other sites More sharing options...
Orio Posted August 31, 2006 Share Posted August 31, 2006 I find it more comfortable to use parenthesis, and there is nothing wrong with doing that...Orio. Quote Link to comment https://forums.phpfreaks.com/topic/19236-nl2br-help-where-to-use/#findComment-83333 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.