|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63427 echo or print don t print spaces and new lines
Submitted: 2012-11-03 12:50 UTC Modified: 2012-11-06 06:18 UTC
From: abelahcene at gmail dot com Assigned:
Status: Not a bug Package: Online Doc Editor problem
PHP Version: 5.4Git-2012-11-03 (Git) OS: linux debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: abelahcene at gmail dot com
New email:
PHP Version: OS:


 [2012-11-03 12:50 UTC] abelahcene at gmail dot com
From manual page:

echo   or print  don t  print spaces and new lines

so echo "hello \n world \n hello again"

is printed in the same line.

same problem with print.

Test script:
echo "hello \n world \n hello again"



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-11-04 02:15 UTC] niel dot archer at gmail dot com
Works fine for me using v5.3.13, what version are you using.
Be sure you are using double-quotes, not single-quotes, or the line-feeds will not 
 [2012-11-06 06:01 UTC] rbrunius at gmail dot com
Are you looking at the output with a web browser? If so the "\n" does not cause a 
line break. You need a "<br />".
 [2012-11-06 06:18 UTC]
-Status: Open +Status: Not a bug
 [2012-11-06 06:18 UTC]
Not a bug. And I don't think it's worth mentioning HTML in the documentation 

And you could use nl2br().
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 05:01:29 2024 UTC