|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80538 SUGGESTION: Add reference to array destructuring of return values
Submitted: 2020-12-21 23:15 UTC Modified: 2020-12-21 23:21 UTC
From: toolmakersteve2 at shawstudio dot com Assigned:
Status: Open Package: Arrays related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: toolmakersteve2 at shawstudio dot com
New email:
PHP Version: OS:


 [2020-12-21 23:15 UTC] toolmakersteve2 at shawstudio dot com
From manual page:

Would be good if this section mentioned use of [array destructuring syntax]( to access elements of a returned array, as a mechanism to simulate "multiple returned values".

[$a, $b, $c] = myfunc();


function myfunc() {
    return ["first", "second", "third"];


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-21 23:17 UTC]
-Package: Documentation problem +Package: Arrays related
 [2020-12-21 23:20 UTC]
Thanks for the suggestion. PRs are welcome. If you can suggest an improvement to the we can take a look and update the documentation.  PHP manual is a collaborative effort.
 [2020-12-21 23:21 UTC]
A simple adjustment would be to amend example #2 to also show destructuring as an alternative to list().
 [2020-12-22 11:53 UTC]
The following pull request has been associated:

Patch Name: Add array destructuring documentation to array syntax section
On GitHub:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Apr 14 09:01:24 2021 UTC