php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13699 when using single quotes, print/printf prints literal "\n"
Submitted: 2001-10-16 19:31 UTC Modified: 2001-10-17 10:49 UTC
From: beckman at purplecow dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.0.6 OS: FreeBSD 4.1
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: beckman at purplecow dot com
New email:
PHP Version: OS:

 

 [2001-10-16 19:31 UTC] beckman at purplecow dot com
This has been confirmed in 4.0.6 on the web and as a standalone for both print and printf.

Output from a test:
(root) hot: 1 : /content/adcritic --> php
<?php
printf('<a href="http://">%s</a>\n',"hi");
X-Powered-By: PHP/4.0.6
Content-type: text/html


<a href="http://">hi</a>\n(root) hot: 1 : /content/adcritic --> php
<?php
printf("<a href='http://'>%s</a>\n","hi");
X-Powered-By: PHP/4.0.6
Content-type: text/html

<a href='http://'>hi</a>

This works:
printf("<a href='http://'>%s</a>\n","hi");

This does NOT work (prints literal "\n"):
printf('<a href="http://">%s</a>\n',"hi");

Same applies to print.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-16 19:51 UTC] mfischer@php.net
This is the intended behaviour when using single quotes. See the appropriate manual entry (sorry don't know it by heart).

- Markus
 [2001-10-17 10:49 UTC] jeroen@php.net
Look in "Part language" - types - strings - single-quoted
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Sep 17 16:01:27 2019 UTC