php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6937 Mid-string expressions not parsed properly
Submitted: 2000-09-29 06:38 UTC Modified: 2000-09-29 07:13 UTC
From: mattw at getacard dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.2 OS: Red Hat Linux 6.2
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: mattw at getacard dot com
New email:
PHP Version: OS:

 

 [2000-09-29 06:38 UTC] mattw at getacard dot com
If $NumFixes = 2, then the following lines of code:

echo("Num fixes: [" . $NumFixes - 1 . "]\n");
echo("Num fixes: [" . ($NumFixes - 1) . "]\n");

Produce this output:

-1]
Num fixes: [1]

I assumed that the echo function, at least, worked the same way in PHP as it does in C.  C doesn't have a concatenation operator though, and maybe this is as intended.  (If it's not, then please fix it, because although the second line of code is "cleaner", the first line should work *anyway*.)

- Matt Waggoner, mattw@getacard.com

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-29 06:41 UTC] mattw at getacard dot com
Duh.  Of course, C doesn't have an echo() function; I meant that subexpression parsing should presumably work the same way (parentheses should not be required between neighbor arguments/concat operators).

- Matt Waggoner
 [2000-09-29 07:13 UTC] andi@php.net
You need to use parentheses because + and . have the same operator precedence.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jul 14 14:00:01 2026 UTC