I have the following PHP array:
stdClass::__set_state(array(
'channels' =>
stdClass::__set_state(array(
'INFORMATIONEN' =>
array (
0 => '👋welcome',
1 => '📜rules',
2 => '📞contact',
),
'NEWS' =>
array (
0 => '✉news',
1 => '🎥videos',
),
'TEAM' =>
array (
0 => '♠team-lounge',
1 => '💻coding',
2 => 'bottest',
3 => '📈Besprechung',
4 => '♠Team Lounge'
),
'LIVE' =>
array (
0 => '🎥Live Stream 1',
1 => '🎥Live Stream 2',
),
'RECORD' =>
array (
0 => '🎥Aufnahme 1',
1 => '🎥Aufnahme 2',
),
'TK' =>
array (
0 => 'Diff',
),
'USER' =>
array (
0 => '🧉lounge-1',
1 => '🧉lounge-2',
2 => '🧉lounge-3',
3 => '🧉Lounge 1',
4 => '🧉Lounge 2',
5 => '🧉Lounge 3',
),
'Support' =>
array (
0 => 'supportticket',
),
'AFK' =>
array (
0 => '🛌AFK',
),
)),
))
Thats the output of the following command:
echo '<pre>' . var_export($decodedChannels, true) . '</pre>';
That's a channel list of a discord server, which I'd like to display on a website.
What it should be displayed like is basically as a nested unordered list something like:
<ul>
<li>INFORMATIONEN</li>
<li>
<ul>
<li>Welcome</li>
<li>rules</li>
<li>contact</li>
</ul>
</li>
<li>NEWS</li>
<li>
<ul>
<li>News</li>
<li>Videos</li>
</ul>
</li>
</ul>
And so on for the other array parts of course. Basically it should look like in discord...
I searched a lot and found various solutions with foreach loops, different ideas and everything, but nothing worked... Either I only got the first layer of the array or only the keys or other issues...
Can anybody point me to the right idea to solve the problem?
recursion.ToUlas mentioned in your link and pass the array to the function. It creates everything except one additionallifor like'INFORMATIONEN'.ToUlfunction is the number 1.. nothing else.. no elements at all...for whatever reason..(inside aul, without anli)