php
php: trying to call data from an object
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?
Array access is with brackets, while object properties are accessed with ->: $tier = $league->data->summonerLeagues[0]->tier; // Fixed typo per #MikePurcell's comment
Related Links
Docker Image installing php modules
Adding Alias in joinWith(YII2) in Linux is not working
PHP/HTML how to get filename from form?
woocommerce pagination product count error
Laravel validation of optional fields
Start array at random position, but follow sequence
Spanning PHP files but method wont echo variables
HTML form not appearing properly - Gives odd results
Nginx proxy pass real ip doesn't work
how to replace url path in html file
PhpStorm & PHPUnit 6 : PhpStorm always creates PHPUnit templates for < 5
MYSQL: Grouping by week intervals, where greater then Monday
Simple Return Statements PHP
PostgreSQL Auto Increment Insert Into with PHP 7 Issue
update on multitable relation
I want to take the first character of use LEFT on laravel `