2015-06-20 122 views
3

我有這個多維數組,我想訪問一個特定的值而不做循環..是否有可能?從多維數組訪問特定值

這裏的數組:

Array 
(
[0] => stdClass Object 
    (
     [akeebasubs_user_id] => 205 
     [user_id] => 268 
     [isbusiness] => 0 
     [businessname] => sci555 
     [occupation] => 
     [vatnumber] => 
     [viesregistered] => 0 
     [taxauthority] => 
     [address1] => Ma. Cristina St. 
     [address2] => Negros Oriental 
     [city] => Dumaguete 
     [state] => IA 
     [zip] => 6200 
     [country] => BS 
     [params] => {"work_telephone":"232424","hospital_company":"sci5","company_introductory":"test","organization_type":"","applicant_url":"www","user_title":"","year_established":"","parent_company":"","r_01":"","r_02":"","r_03":"","r_04":""} 
     [notes] => <p>test</p> 
    ) 

) 

我要的是訪問user_id直接是268

+0

爲什麼不使用foreach循環和你的東西來實現輸出? –

回答

2

你需要做到以下幾點:

var_dump($array[0]->user_id); 

$array是一個條目數組,其中包含一個stdClass對象(you access an object property by using ->)。

+0

非常感謝大衛..工作正常 –

+0

不客氣。請儘快接受答案,只要你能這樣做:)。 – D4V1D