array_unshift page, add an example with two associative arrays#1954
array_unshift page, add an example with two associative arrays#1954tiffany-taylor merged 3 commits intophp:masterfrom
Conversation
|
|
5309ce2 to
d1f71bd
Compare
|
Converting this to draft so that I can provide a better example. |
|
I suggest not to think of "multi-dimensional" arrays in PHP; that eases the understanding how these are handled by language constructs and functions. That said, I'm not against adding such an example for |
|
TFW I realize I meant to call it "associative" and not "multi-dimensional" 😆 |
5be89dc to
9d58378
Compare
|
|
|
@tiffany-taylor, to make the white-space-checker happy, you need to squash the commits, and force-push. |
…evise wording, add types of fruits and vegetables into second example Re: wording revisions: it's an associative array, not a multi-dimensional array, Past Tiffany. 🤦
a688bf6 to
fd15824
Compare
| <title>Usage with associative arrays</title> | ||
| <para> | ||
| If one associative array is prepended to another associative array, | ||
| the prepended array is numerically indexed into the former array. | ||
| </para> |
There was a problem hiding this comment.
Add array_merge() to the See Also, and maybe a note somehow that maybe the function wanted is that one?
There was a problem hiding this comment.
I'm not sure I agree with array_merge being the wanted one. I think there will be cases that people will want array_unshift, but this will likely be situations where people have a stronger grasp of the array_* functions.
…#1954) * Add an example showing how two associative arrays are combined * Modernize array syntax in first example, use var_dump over print_r, revise wording, add types of fruits and vegetables into second example * Add `array_merge()` to the "See Also" section
Added an example that shows how two associative arrays are combined using
array_unshift()https://www.php.net/manual/en/function.array-unshift.php