我有一个数组如下所示:
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'。我该怎么做呢?