-1
<?php echo nl2br($valueu->getarea($rows['province'].'|'.$rows['city'].'|'.$rows['area'],' ')); ?></td>

how to put a line break in between city and area when outputted to a browser.

Thanks

user3691314
  • 159
  • 3
  • 5

3 Answers3

1

Use \n. Just add it with the sting like this I."\n" like pie.

You can also use nl2br like this echo nl2br("One line.\nAnother line.");

Idris
  • 997
  • 2
  • 10
  • 27
1

Try double quote "\n".

If you use single quote '\n', PHP will just interpret as a literal \n, but within double quote, it will parse it as an escape sequence (newline character) and echo it. More about strings here.

echo nl2br('Hello \n world');
// -> Hello \n world

echo nl2br("Hello \n world");
// -> Hello <br /> world
Community
  • 1
  • 1
Yanick Rochon
  • 51,409
  • 25
  • 133
  • 214
0

In a browser, you may need to use "<br/>" instead of a newline "\n".

echo($valueu->getarea($rows['province'].'|'.$rows['city'].'<br />'.$rows['area'],' '));

Something like that?

jsickles
  • 421
  • 2
  • 7