php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44486 dot syntax bug
Submitted: 2008-03-19 22:37 UTC Modified: 2008-03-20 02:31 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kowales at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Windows XP SP2
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: kowales at gmail dot com
New email:
PHP Version: OS:

 

 [2008-03-19 22:37 UTC] kowales at gmail dot com
Description:
------------
I found error in join(dot) string syntax

Reproduce code:
---------------
//this works
<?php
$v1="blabla";
$tmp=(!empty($v1)) ? "," : "";
$v2.=$v1.$tmp;
print $v2;


//this should works
$v1="blabla";
$v2.=$v1.(!empty($v1)) ? "," : "";
print $v2;
?>

Expected result:
----------------
blabla,blabla,

Actual result:
--------------
,blabla,

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-20 02:31 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Hello,

$v2 .= $v1.(!empty($v1)) ? "," : ""; 
is equal
$v2 .= ($v1.(!empty($v1))) ? "," : "";

See the list precedence of operators, and the example about associativity in:
http://docs.php.net/manual/en/language.operators.php

$v2 .= $v1. (!empty($v1) ? "," : "");

It's the proper.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 07:01:31 2025 UTC