# `list()` and the `ArrayAccess` Interface

> Section in “New and Extended Functionality › Arrays” of the book [PHP 7 Explained](https://php7explained.com/) by Sebastian Bergmann and Stefan Priebsch, published by thePHP.cc. The book covers PHP 7.0 to 7.4 and was last updated in November 2020. HTML version: <https://php7explained.com/new-and-extended-functionality/arrays/list-and-the-arrayaccess-interface/>

PHP 7 adds support for using the `list()` statement with classes that implement the `ArrayAccess` interface:

``` php
$obj = new ArrayObject(['a', 'b']);

list($a, $b) = $obj;

var_dump($a, $b);
```

Executing the above example will result in the following output when PHP 7 is used:

    string(1) "a"
    string(1) "b"

In previous versions of PHP both `$a` and `$b` were `null`.

---

Previous: [Short List Syntax](https://php7explained.com/new-and-extended-functionality/arrays/short-list-syntax/index.html.md) | Next: [Specifying Keys in list()](https://php7explained.com/new-and-extended-functionality/arrays/specifying-keys-in-list/index.html.md)
