dimanche 20 avril 2014

accessing an array nested in an object nested in an array


Vote count:

0




this is what I have. I just need to check if the array_key_exists or in_array on the children array.


Tried the following:



if ( in_array( $this->action, $_ms->ms_nav{$this->component}->children[] ) );
if ( in_array( $this->action, $_ms->ms_nav{$this->component}['children'] ) );
if ( in_array( $this->action, $_ms->ms_nav{$this->component}->children[] ) );


which returns Fatal error: Cannot use object of type stdClass as array



[the_nav] => Array
(
[friends] => stdClass Object
(
[page_id] => 589
[slug] => friends
[title] => Friends
[alt_text] => View and Manage Friends
[link_title] => Friends Listing
[children] => Array
(
[my_friends] => Array
(
[slug] => my_friends
[name] => My Friends
[title] => My Friends
[alt_text] => View Your Friendships
)

[requests] => Array
(
[slug] => requests
[name] => Friend Requests
[title] => Friend Requests
[alt_text] => View Friend Requests
)

)

)

[follow] => stdClass Object
(
[page_id] => 587
[slug] => follow
[title] => Follow
[alt_text] =>
[link_title] => Follower / Following
[children] => Array
(
[followers] => Array
(
[slug] => followers
[name] => My Followers
[title] => My Followers
[alt_text] => View Your followers
)

[following] => Array
(
[slug] => following
[name] => Who Im Following
[title] => Who Im Following
[alt_text] => View Your following
)

)

)

)


asked 35 secs ago






Aucun commentaire:

Enregistrer un commentaire