例如,我有多維數組如下:獲取多維數組的關鍵?
$array = array (
0 =>
array (
'id' => '9',
'gallery_id' => '2',
'picture' => '56475832.jpg'
),
1 =>
array (
'id' => '8',
'gallery_id' => '2',
'picture' => '20083622.jpg'
),
2 =>
array (
'id' => '7',
'gallery_id' => '2',
'picture' => '89001465.jpg'
),
3 =>
array (
'id' => '6',
'gallery_id' => '2',
'picture' => '47360232.jpg'
),
4 =>
array (
'id' => '5',
'gallery_id' => '2',
'picture' => '4876713.jpg'
),
5 =>
array (
'id' => '4',
'gallery_id' => '2',
'picture' => '5447392.jpg'
),
6 =>
array (
'id' => '3',
'gallery_id' => '2',
'picture' => '95117187.jpg'
)
);
我怎樣才能得到的array(0,1,2,3,4,5,6)
關鍵?
我已經嘗試了很多例子,但沒有爲我工作。
是的,它的工作,但,我需要在數組中搜索例如id = 9,並獲得數組鍵的返回id,其中id = 9 –
@JurijsGuščins請參閱上面的編輯。 – DaveRandom
完美地工作。真的很大thanx :) –