Jump to content

Archived

This topic is now archived and is closed to further replies.

Mutley

nl2br help, where to use?

Recommended Posts

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.


Share this post


Link to post
Share on other sites
Instead of using the short way "<?=", try using echo().

<?php
echo(nl2br($row['location']));
?>

Orio.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
echo is language construct, not a function, thus you shouldn't use parenthesis.
[code]<?php

echo nl2br($row['location']);

?>[/code]

Share this post


Link to post
Share on other sites
I find it more comfortable to use parenthesis, and there is nothing wrong with doing that...

Orio.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.