# list()现在支持键名

现在[list()](https://php.net/manual/zh/function.list.php)支持在它内部去指定键名。这意味着它可以将任意类型的数组 都赋值给一些变量（与短数组语法类似）

**此例子我在PHP Version 7.1.5测试中始终报错，具体的功能和对称阵列解构的新特征一样**

```php
<?php
$data = [
    ['id' => 1, 'name' => 'Tom'],
    ['id' => 2, 'name' => 'Fred'],
];

while (list('id' => $id, 'name' => $name) = $data) {
    // logic here with $id and $name
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://php7.shujuwajue.com/php-71x-xin-te-xing/xin-te-xing/listxian-zai-zhi-chi-jian-ming.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
