Skip to content

Conversation

@browner12
Copy link
Contributor

the wording here is just a little unclear. the first sentence seems to suggest that the forget() method does not return anything, even though it does.

you are free to assign the result to a new variable even though you don't need to (and maybe shouldn't?)

$collection = collect(['name' => 'taylor', 'framework' => 'laravel']);
 
$newCollection = $collection->forget('name');

dump($collection === $newCollection); // true

the wording here is just a little unclear. the first sentence seems to suggest that the `forget()` method does not return anything, even though it does.

you are free to assign the result to a new variable even though you don't need to.
@taylorotwell taylorotwell merged commit 426c628 into laravel:11.x Oct 23, 2024
@browner12 browner12 deleted the AB-collection-forget-clarification branch October 23, 2024 14:27
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.

2 participants