[英]Echo nested stdClass object inside array
The following data is stored as a PHP multidimensional array.以下数据存储为 PHP 多维数组。 How would I echo out " Reading/Social" from this array?
我如何从这个数组中呼出“阅读/社交”? This is my first experience playing around with multidimensional arrays and object oriented programming, so I'm not really sure where to start.
这是我第一次玩多维 arrays 和 object 面向编程的经验,所以我不确定从哪里开始。
I have tried echo $roster[0]->class;
我试过
echo $roster[0]->class;
but this does not work.但这不起作用。 What am I doing wrong?
我究竟做错了什么?
Array
(
[0] => stdClass Object
(
[class] => stdClass Object
(
[alternateLink] => https://classroom.google.com/c/MjE5ODTA3NTc0
[calendarId] => c_classroom96eb75a@group.calendar.google.com
[courseGroupEmail] => test@school.org
[courseState] => ACTIVE
[creationTime] => 2021-01-02T17:28:07.444Z
[description] =>
[descriptionHeading] =>
[enrollmentCode] => sretszz
[guardiansEnabled] =>
[id] => 219850017574
[name] => 🔴 Reading/Social
The following data is stored as a PHP multidimensional array.以下数据存储为 PHP 多维数组。 How would I echo out " Reading/Social" from this array?
我如何从这个数组中呼出“阅读/社交”? This is my first experience playing around with multidimensional arrays and object oriented programming, so I'm not really sure where to start.
这是我第一次玩多维 arrays 和 object 面向编程的经验,所以我不确定从哪里开始。
I have tried echo $roster[0]->class;
我试过
echo $roster[0]->class;
but this does not work.但这不起作用。 What am I doing wrong?
我究竟做错了什么?
Array
(
[0] => stdClass Object
(
[class] => stdClass Object
(
[alternateLink] => https://classroom.google.com/c/MjE5ODTA3NTc0
[calendarId] => c_classroom96eb75a@group.calendar.google.com
[courseGroupEmail] => test@school.org
[courseState] => ACTIVE
[creationTime] => 2021-01-02T17:28:07.444Z
[description] =>
[descriptionHeading] =>
[enrollmentCode] => sretszz
[guardiansEnabled] =>
[id] => 219850017574
[name] => 🔴 Reading/Social
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.