Re: [PROPOSAL] Bare name array literals (again)
Am 21.06.2021 um 18:54 schrieb tyson andre <tysonandre775@hotmail.com>:
> return [success: true, data: $data, cursor: $cursor];
> // is equivalent to the following, but shorter:
> return ['success' => true, 'data' => $data, 'cursor' =>
> $cursor];
Just a little side-note: A while ago I proposed a 2-line-patch to allow :$foo as a synonym for
'foo' => $foo.
This allows for
return ['success' => true, :$data, :$cursor];
which is both shorter and removes repetition while keeping the variable usage $data and $cursor
visible.
I know that this has been shot down before but I couldn't resist mentioning it in this context,
sorry ;-)
- Chris
Thread (12 messages)