php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #20516 RFC: C-style string concatenation
Submitted: 2002-11-20 07:30 UTC Modified: 2002-11-20 08:07 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dw-php dot net at botanicus dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.2.3 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: dw-php dot net at botanicus dot net
New email:
PHP Version: OS:

 

 [2002-11-20 07:30 UTC] dw-php dot net at botanicus dot net
Hi there,

I was wondering if it would be at all possible to get ANSI C / ISO C99-style string literal concatenation added?

The PHP syntax already borrows so much from C that this seems to be a worthy addition. It would also make it much easier for wrapping ugly SQL for pretty source files.

String literal concatenation being:

$a =   "MY NAME IS "
"DAVE WILSON" /* some comment tokens
that get ignored */ "WAS HERE" // 2002
"2003";


Or, more useful:

"SELECT id,x,y,z FROM tbl " /* grab required cols */
"WHERE y = %d"  /* for our y coordinate. */

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-20 07:38 UTC] sander@php.net
Why do you want that? PHP really doesn't need that, since we have the dot as string concatenation operator. What's wrong with it?
"FOO" . /* weird comment if you like that */ "BAR"

 [2002-11-20 08:02 UTC] dw-php dot net at botanicus dot net
Conformity, ease of porting, the usual reasons why a change might be made. IMHO, the dot operator is ugly and I hate using it, simply because of the colour it appears as in vim :).

If no-one wants to hack this in, can I be pointed toward the correct place in the source so I may? Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jan 14 05:01:28 2025 UTC