Convert the json of the opposite party printed from foreach

this is the json structure of Fang Hui
clipboard.png

this is my method if I want to show it

<? foreach ($dataUserList->{"themes"} as $key) { ?>
          <? foreach ($key->{"theme-participants"} as $value) { ?>
            <?=$value->{"user-name"};?>
          <? } ?>
        <? } ?>

is there a way not to use two foreach? Is there any easy way to achieve the same effect?

Jun.30,2022

invite.
there is a small doubt, the returned json, why not get the number in the form of json_decode ($json,true);, and then iterate through the number?
then the second question: will there be multiple themes when it is traversed? So take a look outside
the third question: does theme-participants also have multiple numbers?

if you just look at your returned structure, I only know that it is a single structure, which seems to be available without two foreach, but I don't know much about the specific services.

after you answer my above questions, I will ask you to answer them.


Thank you for the invitation

after reading the comments, there will be only one themes , so just get [0] and

.
$arr = json_decode($dataUserList,true);
foreach ($arr[0]['themes']['theme-participants'] as $value)
{
    echo $value['user-name'];
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eab106-2027.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eab106-2027.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?