php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45142 Request that NowDoc works within class const
Submitted: 2008-05-31 04:41 UTC Modified: 2008-05-31 14:35 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: chadsspameateremail at yahoo dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3CVS-2008-05-31 (snap) OS: Mac OS X
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: chadsspameateremail at yahoo dot com
New email:
PHP Version: OS:

 

 [2008-05-31 04:41 UTC] chadsspameateremail at yahoo dot com
Description:
------------
I have read about nowdoc which sounds exciting and is currently being added in 5.3.0!  After quickly searching the bugs reported on php.net I couldn't figure out if nowdoc strings work within class constants or not and what the plan was going forward. 

I am formally requesting that nowdoc works from within constants defined within classes.  This would be *very* handy.
An example is shown below.  Actually this is just a modified example of what I found online documenting nowdoc at:
http://ca3.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc

    <?php
    class foo {
        const kbar = <<<'EOT'
    bar
    EOT;
    }
    ?>

Because nowdocs "can be used in any static data context" according to the documentation I don't see why it couldn't be used from within class constants as shown above (hopefully!).  In any case I'm requesting that this feature is implemented.  I don't know if this is already what is planned or not but I certainly hope it gets added.  Maybe it has already been planned and added for all I know.  :)

Thank you. :)
Chad.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-31 12:00 UTC] felipe@php.net
It works with class constants.
 [2008-05-31 14:34 UTC] chadsspameateremail at yahoo dot com
Yay!!!
 [2008-05-31 14:35 UTC] chadsspameateremail at yahoo dot com
:) :) :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 13:01:31 2025 UTC