Outdated description of array assignment without key
Nobody has claimed this yet.
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
PHP manual https://www.php.net/manual/en/language.types.array.php states,
As mentioned above, if no key is specified, the maximum of the existing int indices is taken, and the new key will be that maximum value plus 1 (but at least 0).
However, since PHP 8.0, the auto-incremented key can be nagative.
$xs = [-10 => ""];
$xs[] = 42;
var_dump($xs);
In PHP 8.0 or later:
array(2) {
[-10]=>
string(0) ""
[-9]=>
int(42)
}
In PHP 7.4 or older:
array(2) {
[-10]=>
string(0) ""
[0]=>
int(42)
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the PHP manual's language.types.array.php page and find the description of array assignment without a key. Update the wording to account for PHP 8.0 and later, where the auto-incremented key can remain negative as shown by the provided example; verify that the documented behavior still distinguishes older PHP versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100