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

Add array destructuring example to language.types.array #19

Closed
wants to merge 10,000 commits into from
Closed

Add array destructuring example to language.types.array #19

wants to merge 10,000 commits into from

Conversation

rask
Copy link

@rask rask commented Nov 27, 2019

I'm not sure if PRs are accepted here, but here goes:

Simple example of the PHP 7.1 array destructuring feature.

There seems to be no official manual page/section for this, so adding it here with the rest of the array syntax-y things.

KalleZ and others added 30 commits May 11, 2019 14:59
Patch provided by Michal Brzuchalski

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347416 c90b9560-bf6c-de11-be94-00142212c4b1
… assume marking this as optional is incorrect. If this is not the case feel free to revert the change.

- girgias

--------------

Clarifying the type declaration for the $idx parameter. I encountered a Fatal error:

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to ParleParser::sigil() must be of the type integer, array given

In PHPStorm, looking at the stub for Parle/Parser.php it declares the type of $idx as an array instead of int. I'm planning to submit a patch to JetBrains once this documentation has been updated :)

-- 
Provided by anonymous 97393 (me@rowles.ch)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347417 c90b9560-bf6c-de11-be94-00142212c4b1
Provided by anonymous 75058 (michal.brzuchalski@gmail.com)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347419 c90b9560-bf6c-de11-be94-00142212c4b1
Provided by anonymous 75058 (michal.brzuchalski@gmail.com)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347420 c90b9560-bf6c-de11-be94-00142212c4b1
…atch the same style guide.

-- 
Provided by anonymous 75058 (michal.brzuchalski@gmail.com)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347421 c90b9560-bf6c-de11-be94-00142212c4b1
…r between file extensions in the list. Closes #67701

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347422 c90b9560-bf6c-de11-be94-00142212c4b1
…nown encoding value is passed in as the 2nd parameter.

-- 
Provided by anonymous 96370 (mbniebergall@gmail.com)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347424 c90b9560-bf6c-de11-be94-00142212c4b1
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347431 c90b9560-bf6c-de11-be94-00142212c4b1
For all practical purposes, the default value is actually an empty array.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347436 c90b9560-bf6c-de11-be94-00142212c4b1
This integrates user note 13441.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347443 c90b9560-bf6c-de11-be94-00142212c4b1
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347449 c90b9560-bf6c-de11-be94-00142212c4b1
…ple showing that array-map returns the original array if only one array is provided with a NULL callback.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347462 c90b9560-bf6c-de11-be94-00142212c4b1
Provided by sergey

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347472 c90b9560-bf6c-de11-be94-00142212c4b1
…ative precision).

Added more information to the return value of the function.
Added a specific example demonstrating various precision on a float.
Improved other examples.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347481 c90b9560-bf6c-de11-be94-00142212c4b1
-- 
Provided by anonymous 98113 (michel@michelmaas.com)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347486 c90b9560-bf6c-de11-be94-00142212c4b1
Patch provided by anonymous user.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347496 c90b9560-bf6c-de11-be94-00142212c4b1
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347499 c90b9560-bf6c-de11-be94-00142212c4b1
…unctions return an empty array if called without any arguments.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347508 c90b9560-bf6c-de11-be94-00142212c4b1
Pieter Hordijk and others added 17 commits November 8, 2019 23:59
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348273 c90b9560-bf6c-de11-be94-00142212c4b1
This addresses several user notes.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348286 c90b9560-bf6c-de11-be94-00142212c4b1
Since the latter is not marked as being unmaintained on the respective
PECL page, we refrain from adding a deprecated warning (yet).

This integrates user note 124378.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348288 c90b9560-bf6c-de11-be94-00142212c4b1
Patch by BenMorel.

Closes #16.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348296 c90b9560-bf6c-de11-be94-00142212c4b1
Patch by BenMorel.

Closes #17.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348297 c90b9560-bf6c-de11-be94-00142212c4b1
strip_tags() is *not* a security feature.



git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348311 c90b9560-bf6c-de11-be94-00142212c4b1
The function works as getter and setter, respectively.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348317 c90b9560-bf6c-de11-be94-00142212c4b1
This integrates user note 124413.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348333 c90b9560-bf6c-de11-be94-00142212c4b1
Integrates user note 124350.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348334 c90b9560-bf6c-de11-be94-00142212c4b1
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348336 c90b9560-bf6c-de11-be94-00142212c4b1
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@348349 c90b9560-bf6c-de11-be94-00142212c4b1
@nikic
Copy link
Member

nikic commented Dec 4, 2019

@salathe Is that a reasonable place to put this?

@salathe
Copy link
Contributor

salathe commented Dec 4, 2019

@salathe Is that a reasonable place to put this?

I would prefer a new page on the topic of destructuring (though I'm not sure the best place for that), which can then be referenced from the array-related pages and other pages like list().

However, in the interest of just having this written down somewhere (other than the migration guide, or user contributed notes) being better than nowhere, including the proposed section in the array page would be a good starting point.

@rask
Copy link
Author

rask commented Dec 4, 2019

Agreed, the topic is large enough to warrant a separate page in my opinion as well. This PR is mainly to just have it visible somewhere as stated. My inspiration was a PHP veteran using latest PHP saying "wtf since when has that been possible" when I showed them an example, and they said no amount of search returned results in the manual for it.

Is the position on the page OK or would it work better somewhere else?

@salathe
Copy link
Contributor

salathe commented Aug 28, 2020

@rask this PR has gotten all out of shape due to the forced pushes on the php/doc-en master branch. Is this still something you want to pursue, or should we just lay this PR to rest?

@rask
Copy link
Author

rask commented Sep 8, 2020

Hello. Sorry, the new GitHub notification center is seemingly broken and I can't see any notifications anywhere. Or maybe I just don't understand how it works haha. I stumbled on this on the GitHub frontpage, which I see maybe once a year.

I'll see if I can remold this to fit the new base.

@rask rask marked this pull request as draft September 8, 2020 21:42
@rask
Copy link
Author

rask commented Sep 8, 2020

You know what, the base has changed so much a simple master to master rebase is giving me tons and tons of merge conflcts for no good reason. I shall refork and redo the commit manually and create a new PR.

@rask
Copy link
Author

rask commented Sep 8, 2020

New one at #145.

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

Successfully merging this pull request may close these issues.