key =>使用变量的值对

时间:2014-05-15 09:38:46

标签: php

所以我有一个名为$ items的数组,我迭代到:

foreach($area as $item) {
    $options["{$item['id']}"] = "{$item['name']} ({$item['id']})"; //pass
}

循环中的每个传递产生如下:

[1] => string(18) "grand ballroom (1)"

但我需要的是它:

['1']=> string(18) "grand ballroom (1)"

我怎样才能做到这一点?谢谢!

0 个答案:

没有答案
相关问题