Different results for function() and fn(). PHP

I have a problem.

$this->allIds->each(function ($id) {
    $this->checked[$id] = $this->checkedAll;
});

And this:

$this->allIds->each(fn($id) => $this->checked[$id] = $this->checkedAll);

return different results… Why? 🙂
In full version i have this:
Result with function()
In short version i have this:
Result with fn()

Thanks 🙂