php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2194 newline character ( \n ) ignored/treated as a single space
Submitted: 1999-08-30 13:10 UTC Modified: 1999-08-30 15:07 UTC
From: jkjome at creativeis dot com Assigned:
Status: Closed Package: Other
PHP Version: 4.0 Beta 2 OS: NT4
Private report: No CVE-ID: None
 [1999-08-30 13:10 UTC] jkjome at creativeis dot com
Here is an example:

<?php  for ($i = 4; $i < 8; $i++) {
   print "I have eaten $i bagels today.\n";} 
?>

Even with the newline character there, no new line is generated in the output.  As you can see, this happens with print, but it also happens with printf and echo.

The only thing it does is add a single space where it should have been a new-line.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-30 15:07 UTC] eschmid at cvs dot php dot net
You are outputting HTML. new lines are eaten up in HTML.
the proper HTML tag to make a newline is <br>.

Mark

Bug closed by 

-Egon
 [2004-09-28 21:54 UTC] lmohr at eatoncounty dot org
test
new
line
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Aug 16 03:00:03 2025 UTC