Accessing a specific value from a multidimensional array
I have this multidimensional array and I want to access a specific value without doing a loop. Is it possible?
here's an array:
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>
)
)
i want to access user_id
which is 268
directly.
+3
source to share
1 answer
You will need to do the following:
var_dump($array[0]->user_id);
$array
is a single input array containing an object stdClass
( to access the object using->
).
+2
source to share