Muhammad Ali Hassan
Muhammad Ali Hassan

Reputation: 962

how to find 2nd element of stdclass object array

i want remote html content on my page. for that i am getting an array in stdclass object array. i print_r(array) which is given below

stdClass Object (
     [player_video] => Array ( )
     [Title] => Ciara
     [video_Link] => Oh.flv
     [img] => img
     [desc] =>
     [view] => 18
     [artist_name] => Ciara
 ) 

how can i get title from this array. i tried $array[0]['Title'] $array['player_video']['Title'] but all these type of functions return nothing. i think i m using wrong approach. Please guide how to achieve this. Thanks

Upvotes: 0

Views: 576

Answers (3)

Monwabisi Sifumba
Monwabisi Sifumba

Reputation: 40

If it's an object then try:

$stdClass->Title;

Upvotes: 0

Fabian Schmengler
Fabian Schmengler

Reputation: 24551

$array seems not to be an array at all. You'll get the title attribute of this object with $array->Title

Upvotes: 1

Parag Tyagi
Parag Tyagi

Reputation: 8970

Use arrow -> instead of square brackets []. Try this -

$array->Title

Upvotes: 0

Related Questions