的鍵名我有一個數組,如下所示:PHP - 獲取數組值
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'
由其索引。我怎樣才能做到這一點?
您可以通過使用細說你想要達到什麼目的? – 2012-01-04 15:34:11