Re: [PROPOSAL] Bare name array literals (again)

From: Date: Mon, 21 Jun 2021 21:03:33 +0000
Subject: Re: [PROPOSAL] Bare name array literals (again)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-114992@lists.php.net to get a copy of this message
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)

« previous php.internals (#114992) next »