3

I have this multidimensional array and I want to access a specific value without doing loop.. is it possible?

here's the 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>
    )

)

what I want is to access the user_id which is 268 directly.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Sam Teng Wong
  • 2,379
  • 5
  • 34
  • 56

1 Answers1

2

You will need to do the following:

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

$arrayis a one-entry array that contains an stdClass object (you access an object property by using ->).

Community
  • 1
  • 1
D4V1D
  • 5,805
  • 3
  • 30
  • 65
  • You're welcome. Please also feel free to accept the answer as soon as you will be able to do so :). – D4V1D Jun 20 '15 at 09:25