rfc:array_unpacking_string_keys
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:array_unpacking_string_keys [2021/01/07 11:24] – created nikic | rfc:array_unpacking_string_keys [2021/02/09 09:55] (current) – nikic | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Date: 2021-01-07 | * Date: 2021-01-07 | ||
* Author: Nikita Popov < | * Author: Nikita Popov < | ||
- | * Status: | + | * Status: |
* Proposed Version: PHP 8.1 | * Proposed Version: PHP 8.1 | ||
* Implementation: | * Implementation: | ||
Line 40: | Line 40: | ||
// Which is [0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6] | // Which is [0 => 1, 1 => 2, 2 => 3, 3 => 4, 4 => 5, 5 => 6] | ||
// where the original integer keys have not been retained. | // where the original integer keys have not been retained. | ||
+ | </ | ||
+ | |||
+ | Keys that are neither integers nor strings continue to throw a '' | ||
+ | |||
+ | Traversables may also generate integral string keys, which are canonicalized to integer keys by arrays. Such keys will be treated the same way as integer keys and renumbered: | ||
+ | |||
+ | <PHP> | ||
+ | function gen() { | ||
+ | yield " | ||
+ | yield " | ||
+ | yield " | ||
+ | } | ||
+ | var_dump([...gen()]); | ||
</ | </ | ||
Line 103: | Line 116: | ||
===== Vote ===== | ===== Vote ===== | ||
- | Yes/No. | + | Voting started on 2021-01-25 and ended on 2021-02-08. |
+ | |||
+ | <doodle title=" | ||
+ | | ||
+ | | ||
+ | </ | ||
rfc/array_unpacking_string_keys.1610018658.txt.gz · Last modified: 2021/01/07 11:24 by nikic