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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 12:01:31 2024 UTC