Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referenced page does not mention negative keys #3035

Open
adrolter opened this issue Dec 24, 2023 · 1 comment
Open

Referenced page does not mention negative keys #3035

adrolter opened this issue Dec 24, 2023 · 1 comment

Comments

@adrolter
Copy link

From manual page: https://php.net/function.array-fill

The Notes section links to and mentions that the page about the array datatype has a detailed explanation about negative keys, but the page makes no reference to the word "negative" whatsoever and doesn't provide further context without using that particular terminology that I could find. Perhaps it was removed at some point and this reference wasn't cleaned up?

@damianwadley
Copy link
Member

While it's hardly the "detailed" explanation implied, the note was added in 2007 with a340890 and I'm assuming was in reference to a warning on the arrays page:

As of PHP 4.3.0, the index generation behaviour described above has changed. Now, if you append to an array in which the current maximum key is negative, then the next key created will be zero (0). Before, the new index would have been set to the largest existing key + 1, the same as positive indices are.

So there's two parts to this:

  1. Does something need to be mentioned in the arrays page about the change between PHP 7 and 8? Would probably be nice, given that the upgrade guide only gives it a short one-line bullet point.
  2. Does something need to be mentioned in the array_fill page? Presumably meaning a link to the arrays page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants