php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70227 Define consts with heredocs/nowdocs
Submitted: 2015-08-10 12:21 UTC Modified: 2015-08-10 12:51 UTC
From: dpa-bugs at aegee dot org Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dpa-bugs at aegee dot org
New email:
PHP Version: OS:

 

 [2015-08-10 12:21 UTC] dpa-bugs at aegee dot org
Description:
------------
---
From manual page: http://www.php.net/language.types.string
---
The above page states under Heredocs:

" As of PHP 5.3.0, it's possible to initialize static variables and class properties/constants using the Heredoc syntax:"

Example #4 Using Heredoc to initialize static values"

The example shows how to use heredoc to put data in const member.

But under nowdocs it states:
"Unlike heredocs, nowdocs can be used in any static data context. The typical example is initializing class properties or constants:

Example #7 Static data example"

Then http://php.net/manual/en/language.oop5.constants.php repeats "Unlike heredocs, nowdocs can be used in any static data context. "

The contradition is that Example 4 demonstrates how to use heredoc to store data in const member, but the text describes this as not allowed.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-10 12:50 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=337388
Log: updated manual wrt. Heredoc support for initializing consts and static members (fixes #70227)
 [2015-08-10 12:51 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-08-10 12:51 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 21:00:02 2026 UTC