php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49772 Cast operators marked as non-associative
Submitted: 2009-10-04 23:00 UTC Modified: 2009-11-13 21:40 UTC
From: mjomble at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mjomble at gmail dot com
New email:
PHP Version: OS:

 

 [2009-10-04 23:00 UTC] mjomble at gmail dot com
Description:
------------
The operator precedence page (language.operators.precedence.php) lists the following operators as non-associative:

~ - (int) (float) (string) (array) (object) (bool) @

However, all of these seem to behave like right-associative operators.

Examples:
- - 3 evaluates like -(-3)) = 3
~ ~ 3 evaluates like ~(~3)) = 3
- - - 3 evaluates like -(-(-3))) = -3
~ ~ ~ 3 evaluates like ~(~(~3))) = ~3 = -4
(int) (string) 3 evaluates to integer 3
(string) (int) 3 evaluates to string "3"

It's even possible to use the @ operator more than once in front of a statement. The additional ones don't really do anything useful, but more importantly, they don't trigger any parse errors.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-13 21:40 UTC] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=290705
Log: Some unary operators are associative (bug #49772)
 [2009-11-13 21:40 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Jun 25 02:00:01 2026 UTC