I assume you echo the output into a html page you look at with a web browser? In that case the linebreaks do get copied to the output, however they are not visualized as such. This simply is because in html markup a linebreak is something different to a plain text file.
Check about the use of <br>
or <br />
linebreaks for such markup. Also php offers the handy nl2br()
function for such purpose.
An example for such output (see it here):
Hello World to PHP Concatenation in PHP is done using .
<br />
Vivek kumarLearning phpMy name is Vivek Kumar and age is 26 .
<br />
My name is Vivek Kumar and age is 26.
But in general you should think about whether you really simply want to concatenate such strings when putting them in to html markup. Typically you want to wrap them in (invisible) containers like spans, divs or paragraphs, so that you can control the final layout by using styles (style sheets / css).
An arbitrary example (see it here)
HTML:
<div id="intro">Hello World to PHP Concatenation in PHP is done using .</div>
<h2>Vivek kumarLearning php</h2>
<div class="plain">My name is Vivek Kumar and age is 26 .</div>
<div class="plain">My name is Vivek Kumar and age is 26.</div>
CSS:
body {
font-size: 130%;
}
#intro {
font-weight: bold;
margin-bottom: 10px;
}
.plain {
font-size: 100%;
}
` tag – Girish Oct 11 '14 at 09:35
tag, else if you view this under client, please use "\n". – SuperBear Oct 11 '14 at 09:47
tag for line break thanks – arif_suhail_123 Oct 11 '14 at 09:50