php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73802 Operator Precedence
Submitted: 2016-12-21 18:59 UTC Modified: 2016-12-22 01:07 UTC
From: alexwerser at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 7.0.14 OS:
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: alexwerser at gmail dot com
New email:
PHP Version: OS:

 

 [2016-12-21 18:59 UTC] alexwerser at gmail dot com
Description:
------------
On page http://php.net/manual/en/language.operators.precedence.php indicates that the operator ** is of higher priority than ++ -- ~ (int) (float) (string) (array) (object ) (bool) @, but it is not.

Test script:
---------------
// this script returns 9 instead of 15
$a=4;
echo --$a**2;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-22 01:07 UTC] bwoebi@php.net
-Status: Open +Status: Not a bug
 [2016-12-22 01:07 UTC] bwoebi@php.net
The issue is that --($a ** 2) is not a valid expression. Thus the parser parses it the only possible way: (--$a) ** 2.

And the manual is therefore still correct.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 04:01:23 2020 UTC