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
> 


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to