Quantcast
Channel: PHP Linefeeds (\n) Not Working - Stack Overflow
Browsing latest articles
Browse All 12 View Live

Answer by Nesar Ahmad Nori for PHP Linefeeds (\n) Not Working

The “\n” or “\r” or similar tags are treated as white-space in HTML and browsers. You can use the "pre" tag to solve that issue<?php echo "<pre>"; echo "line1 \n some text \t a tab \r some...

View Article



Answer by Ewer Ling for PHP Linefeeds (\n) Not Working

If you want to print something like this with a newline (\n) after it:<p id = "theyateme">Did it get eaten?</p>To print the above, you should do this:<?php print('<p id =...

View Article

Answer by nilesh for PHP Linefeeds (\n) Not Working

When you run a PHP script in a browser, it will be rendered as HTML by default. If the books you’re using show otherwise, then either the code or the illustration is inaccurate. You can use “view...

View Article

Answer by Pankaj Monga for PHP Linefeeds (\n) Not Working

nl2br() function use for create new lineecho nl2br("Welcome\r\n This is my HTML document", false);The above example will output:WelcomeThis is my HTML document

View Article

Answer by aaron for PHP Linefeeds (\n) Not Working

to place the \n in double quotes try$LOG = str_replace('\n', "\n", $LOG);

View Article


Answer by Huraiby for PHP Linefeeds (\n) Not Working

\n is not meant to be seen as a new line by the end user, you must use the html <br/> element for that./n only affects how the html that is generated by php appears in the source code of the web...

View Article

Answer by Souhaieb Besbes for PHP Linefeeds (\n) Not Working

I'm pretty sure you are outputting to a html file.The problem is html ignores newlines in source which means you have to replace the newlines with <br/> if you want a newline in the resulting...

View Article

Answer by Matt Stephenson for PHP Linefeeds (\n) Not Working

Double quotes are what you want. Single quotes ignore the \ escape. Double quotes will also evaluate variable expressions for you.Check this page in the php manual for more.

View Article


Answer by oshirowanen for PHP Linefeeds (\n) Not Working

You need to use double quotes. Double quotes have more escape chars.error_log("test\n", 3, 'error.log');error_log("test2\n", 3, 'error.log');

View Article


Answer by Jan K. for PHP Linefeeds (\n) Not Working

It's because you use apostrophes ('). Use quotationmarks (") instead. ' prompts PHP to use whatever is in between the apostrophes literally.

View Article

Answer by ceejayoz for PHP Linefeeds (\n) Not Working

Use double quotes. "test\n" will work just fine (Or, use 'test' . PHP_EOL).If the string is enclosed in double-quotes ("), PHP will interpret more escape sequences for special...

View Article

PHP Linefeeds (\n) Not Working

For some reason I can't use \n to create a linefeed when outputting to a file with PHP. It just writes "\n" to the file. I've tried using "\\n" as well, where it just writes "\n" (as expected). But I...

View Article
Browsing latest articles
Browse All 12 View Live




Latest Images