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. 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. 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. 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] 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. 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
Archived
This topic is now archived and is closed to further replies.