php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75842 String concatenation
Submitted: 2018-01-18 14:53 UTC Modified: 2018-01-18 14:56 UTC
From: george at t-c-n dot co dot uk Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.2.1 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: george at t-c-n dot co dot uk
New email:
PHP Version: OS:

 

 [2018-01-18 14:53 UTC] george at t-c-n dot co dot uk
Description:
------------
Not sure if this is a bug or not but I guess reporting it anyway wouldn't hurt.

String concatenation with '=', should this be a syntax error?

Test script:
---------------
<?php

$x = 'hello' .
$y = 'world';

echo $x;

OR

<?php
$x = 'hello' . $y = 'world';

echo $x;

Expected result:
----------------
Syntax error?

Actual result:
--------------
'helloworld'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-18 14:56 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2018-01-18 14:56 UTC] requinix@php.net
No, it's valid syntax. Assignment is an expression that evaluates to the RHS value, so
  $x = 'hello' . $y = 'world';
works like
  $y = 'world';
  $x = 'hello' . 'world';
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC