下面是我有的數組的示例。如何獲得在foreach循環中的數組項的關鍵在php
Array (
[952] => Array ([Date] => 2016-06-23 01:55:17 [SValues] => Array ([total] => 1 [Name] => Name [OverAge] => No))
[91] => Array ([Date] => 2016-06-23 01:55:17 [SValues] => Array ([total] => 1 [Name] => Name [OverAge] => No))
[83] => Array ([Date] => 2016-06-23 01:55:17 [SValues] => Array ([total] => 1 [Name] => Name [OverAge] => No)))
然後,我把這個數組放在foreach循環中。
foreach($the-main-array as $item)
{
//I want to get the key of the item here (952,91,83)
}
那麼我怎樣才能得到循環內的項目的關鍵?
請幫幫我。提前致謝。
去看看'的foreach()'手冊頁 – 2016-07-27 08:10:00