0

I am trying to get specific data set from the object but unable to find out why I cannot call the number in my assignment. This is it as follows:

$teir = $league->data->summonerLeagues->0->teir;

First of all this is calling the data from the league which is set and so that yo can see what the data looks like here it is:

stdClass Object
(
[data] => stdClass Object
    (
        [summonerLeagues] => Array
            (
                [0] => stdClass Object
                    (
                        [queue] => RANKED_SOLO_5x5
                        [name] => Dr. Mundo's Crushers
                        [tier] => BRONZE
                        [requestorsRank] => III
                        [entries] => Array

at this point I am trying to assign the variable $teir to teir in the object but they use 0 in the object and the way I am calling it must be the issue.....

Any suggestions?

1
  • FTR, you have teir misspelled in your call. Commented Mar 11, 2013 at 22:40

1 Answer 1

3

Array access is with brackets, while object properties are accessed with ->:

$tier = $league->data->summonerLeagues[0]->tier; // Fixed typo per @MikePurcell's comment
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.