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

Update docs for optional array_sort callback #3670

Merged
merged 1 commit into from
Sep 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,25 @@ The `array_set` function sets a value within a deeply nested array using "dot" n
<a name="method-array-sort"></a>
#### `array_sort()` {#collection-method}

The `array_sort` function sorts the array by the results of the given Closure:
The `array_sort` function sorts an array by its values:

$array = [
'Desk',
'Table',
'Chair',
];

$array = array_sort($array);

/*
[
'Chair',
'Desk',
'Table',
]
*/

You may also sort the array by the results of the given Closure:

$array = [
['name' => 'Desk'],
Expand Down