php / php/doc-en

Suggestion: Better clarify the assigment operator note on the Operator Precedence documentation page

Open
#2,402 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

There are many questions in StackOverflow about this issue (and one more from me): In some cases, the = operator has higher precedence than the one listed on the documentation page, like in the !$a = foo() example.

I know the = operator is a special one, but trying to understand why it behaves like this I asked my dup question in SO. I was pointed out the note in the documentation. I didn't see it because it was after the examples. I didn't read past them.

So my suggestions are:

  • Move the note up in the page, perhaps at the end of the precedence table, so it'll have more visibility
  • Clarify better that note, because it just says that that behavior happens, but no why it happens, or what are the rules for that.

Thank you very much for your support to PHP ❤️

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked PHP Operator Precedence documentation page and inspect the precedence table, note, and following examples. Move the note to a more visible position and clarify the rules behind the assignment-operator behavior, then verify that the !$a = foo() example is accurately explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.