我有一个如下数组:
function example() {
/* some stuff here that pushes items with
dynamically created key strings into an array */
return array( // now lets pretend it returns the created array
'firstStringName' => $whatEver,
'secondStringName' => $somethingElse
);
}
$arr = example();
// now I know that $arr contains $arr['firstStringName'];
我需要找出索引$arr['firstStringName']
,以便能够遍历array_keys($arr)
,并根据其索引返回密钥字符串'firstStringName'
.我怎么才能做到这一点呢?