Search code examples
phpline-breaksstring-concatenation

Line break not working when concatenating strings


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?


Solution

  • 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.