php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38836 string concatenation operator does not work across multiple lines in classes
Submitted: 2006-09-15 05:34 UTC Modified: 2006-09-15 07:02 UTC
From: evoltech at 2inches dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5CVS-2006-09-15 (snap) OS: Linux
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: evoltech at 2inches dot com
New email:
PHP Version: OS:

 

 [2006-09-15 05:34 UTC] evoltech at 2inches dot com
Description:
------------
PHP is great!  I love this language, and I apreciate the work of the developers ... you are all very awesome!

The following code works as I expect:
<?php
$var = "this" .
   "that" .
   "other\n";
print $var;
?>
thisthatother

When I use the concatenation operator in a class however I get a parse error.

Reproduce code:
---------------
<?php
class foo
{
   public static $var = "this" .
      "that" .
      "other\n";
}
print foo::$var;
?>

Expected result:
----------------
thisthatother


Actual result:
--------------
Parse error: syntax error, unexpected '.', expecting ',' or ';'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-15 07:02 UTC] tony2001@php.net
Expressions are not allowed when declaring class members and constants.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 14:01:37 2025 UTC