Line break not working when concatenating strings

78 Views Asked by At

I was googling a lot about this problem but didn't see any answer that could help me. For example i have next line of code:

$row ['technischgereed'] =  "The quotation is not technically completed \n" . $separatedArray ; 
$row ['technischgereed'] =  "The quotation is not technically completed \r\n" . $separatedArray ;
$row ['technischgereed'] =  "The quotation is not technically completed <br/>" . $separatedArray ;
$row ['technischgereed'] =  "The quotation is not technically completed". "\n(or <br> or \r\n)" . $separatedArray ;

So i want to have something like the following

The quotation is not technically completed
Planned:Kitchen
In execution:Bedroom
Done:Basement 

Instead of this i get everything in a same row.Any suggestions?

2

There are 2 best solutions below

1
On BEST ANSWER

Use nl2br($row['technischgereed']), it will change /n to <br />

Besides that, I think you should use .= for the next message, I only see the equal sign, which means that every new equal overwrites the previous instead of adding to it.

0
On

\n will only be visible in the source as a newline. Use <br /> in stead, or use nl2br() on your $row ['technischgereed'] when echoing it out to convert your newline characters to <br />.