|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20448 I can't concat a string with +=
Submitted: 2002-11-15 10:45 UTC Modified: 2002-11-15 10:48 UTC
From: 00664714 at academ01 dot gda dot itesm dot mx Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.2.3 OS: Windows 2000
Private report: No CVE-ID: None
 [2002-11-15 10:45 UTC] 00664714 at academ01 dot gda dot itesm dot mx
Hi! I have the following code:

   $a_data = array("a","b","c");
   $s_data = "";
   foreach($a_data as $data){
       $s_data += $data;
   echo $s_data;

I was trying to make $s_data contain "abc" but instead I get a 0. It seems that += cube of types returns an int ignoring that the user is trying to concat an string.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-15 10:48 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

strings should be concatinated using a '.'
ex: $b .= "a";
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jun 06 17:03:39 2023 UTC