How can I change this space to a line break in…
<?php echo $model->attribute1.' '.$model->attribute2;?>
I have tried ‘\n’ and ‘r\n’
How can I change this space to a line break in…
<?php echo $model->attribute1.' '.$model->attribute2;?>
I have tried ‘\n’ and ‘r\n’
Add next line as first in your layout file, or disable layout, and next line as first in your view file(or controller action function)
header(‘Content-type: text/plain; charset=iso-8859-1’) for example.
Html doesn’t recognize /n character(or forget everything else I wrote and just use <br /> if you want html output)
if you want to show a line break in html use <br /> as Ivica said.
if you’re programming for console, then it could be useful to have a \n but you have to put in double quotes:
"first line\nsecond line"
if you put in single quotes:
'first line\nsecond line'
the \n will not be interpreted.
Or just use PHP_EOL constant: $line1 . PHP_EOL . $line2
Thanks a Ton Weavora … Helped a lot after load of silly trial of various options