php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #16079 Allow '.' (concat) operator on static strings
Submitted: 2002-03-14 14:01 UTC Modified: 2014-10-12 14:18 UTC
Votes:14
Avg. Score:4.4 ± 1.0
Reproduced:12 of 12 (100.0%)
Same Version:7 (58.3%)
Same OS:9 (75.0%)
From: steve dot venable at lmco dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: * 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: steve dot venable at lmco dot com
New email:
PHP Version: OS:

 

 [2002-03-14 14:01 UTC] steve dot venable at lmco dot com
I can understand requiring constants for static initialization.  But can the parser be modified to support operators on constants for static initializations?  This is especially true for long strings which I can't even break at the end of line for readability.  (I almost submitted this as a bug :)

Examples:
            $v = 1 + 2;   // Okay
     static $s = 1 + 2;   // Fails parse

            $v = "this long "
                 ."string";  // Okay
     static $s = "this long "
                 ."string";  // Fails parse

Since only constants are involved the parser could collapse the expression without difficulty.  This makes the code much more readable (again thinking of very long strings).  In my case I'm building an array of error messages and don't want the array build to occur everytime the function is called, hence I made it static.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-02 02:41 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem -Operating System: All +Operating System: * -PHP Version: 4.1.1 +PHP Version: *
 [2014-10-12 14:18 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2014-10-12 14:18 UTC] nikic@php.net
Supported in 5.6
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC