"
"
<?php
echo "Hello world this is example
in php.";
echo "<br>";
echo nl2br("You will find the
newlines in this string
on the browser window.");
?>
echo "
";
if "test
" not return, new line
1st solution:echo "test".PHP_EOL;
2nd solution:<?php header('Content-type: text/plain'); ?>
3rd solution:"<br />" instead of "
" or "
"
echo "<br>";
echo 'hollow world' . PHP_EOL;
<?php
echo nl2br("If you want that '
' works.
Then use nl2br() function!");
echo "<br> can also be used.";
echo "nl2br() is in-built function whereas <br> is html tag";
?>
return nl2br("This is the cointracker sample text.
This should be line 2!");
//let a variable contain multiple line
//add <br> tag in string
$variable = "123 <br> ";
‘
’ or ‘
’ is the easiest way to embed newlines in a PHP string
// When you run a PHP script in a browser, it will be rendered as HTML by default.
// Use <br /> instead or modify the header to content type plain text
echo "Hello <br /> World";