【发布时间】:2012-02-02 12:06:39
【问题描述】:
我有一个数组如下:
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'。我该怎么做?
【问题讨论】:
-
您能否详细说明您要实现的目标的用例?