php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #51454 Operator => missing from the precedence list
Submitted: 2010-04-01 13:25 UTC Modified: 2010-04-02 16:10 UTC
From: peev dot alexander at gmail dot com Assigned: rquadling (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2010-04-01 13:25 UTC] peev dot alexander at gmail dot com
Description:
------------
On the 'Operator precedence' manual page( http://www.php.net/manual/en/language.operators.precedence.php )
the => operator seems to be missing from the list. Its precedence might be obvious to some, or most, 
but I suppose it would be better if it is included in the php documentation. 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-01 13:31 UTC] peev dot alexander at gmail dot com
P.S. I was going to write a comment on the manual page, but unless the developers don't consider it a bug, I won't proceed with posting it.
 [2010-04-01 13:51 UTC] rquadling@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=297272
Log: Document array key => value operator assignment. Fix bug#51454
 [2010-04-01 13:52 UTC] rquadling@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rquadling
 [2010-04-01 13:52 UTC] rquadling@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.


 [2010-04-02 16:10 UTC] peev dot alexander at gmail dot com
Thank you for your quick action, but I'm not sure this is the correct precedence for that operator: 

 since '=>' and the ('or', 'and' and 'xor' ) operators 
can be used together, (through testing) I have found out 
that the precedence of the '=>' operator is between 
the 'or' operator and the ',' operator, 
and that it has no associativity. 

Please correct me if I'm wrong. 

 
(example:

var_dump(array('key1' => TRUE xor TRUE));
will yield: 
array(1) {
  ["key1"]=>
  bool(false)
}

, and:

var_dump(array(0 or  'key2' => TRUE));
will yield:
array(1) {
  [1]=>
  bool(true)
}

)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 22 09:01:29 2024 UTC