Re: [RFC] Allow specifying keys in list()
| From: | Thomas Bley | Date: | Mon, 18 Jan 2016 13:19:11 +0000 |
| Subject: | Re: [RFC] Allow specifying keys in list() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-90699@lists.php.net to get a copy of this message | ||
What about using objects with list()?
class Point {
public function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
}
$point = new Point(21, 42);
list('x' => $x, 'y' => $y) = $point;
Regards
Thomas
Andrea Faulds wrote on 17.01.2016 03:32:
> Hi everyone,
>
> Here's an RFC that would extend the syntax of list() to be more useful
> with associative arrays:
>
> https://wiki.php.net/rfc/list_keys
>
> Please read it and tell me your thoughts.
>
> Thanks!
> --
> Andrea Faulds
> https://ajf.me/
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>