Note that there are some explanatory texts on larger screens.

plurals
  1. POEcho specific values from multidimensional array PHP Basecamp
    text
    copied!<p>I try to echo a value from a multidimensional array but somehow I can't figure it out.</p> <p>The structure of this array is as followed:</p> <p>todos</p> <blockquote> <ul> <li>remaining <ul> <li>id</li> <li>todolist_id</li> <li>position</li> <li>content</li> <li>completed</li> <li>created_at</li> <li>updated_at</li> <li>comments_count</li> <li>due_on</li> <li>due_at</li> <li>creator (array with: id, name, avatar url)</li> <li>assignee (array with: id, type, name)</li> </ul></li> <li>completed</li> </ul> </blockquote> <p>My problem at the moment is, I am unable to echo/print the values from the due_at and due_on (which are the only 2 I need). As I figured out this is most likely caused by the 2 arrays (creator, assignee) at the end. Since every time I try to view the values it stops before the creator part and does not show the other todos, just the first one. here is the piece of code I used to echo the values:</p> <pre><code>foreach($todo_itemphp-&gt;todos as $key =&gt; $value) { echo "&lt;ul&gt;"; echo "&lt;li&gt;".$key. ":". "&amp;nbsp". "&lt;/li&gt;"; foreach ($value as $key2 =&gt; $value2) { echo "&lt;ul&gt;"; echo "&lt;li&gt;".$key2. ":". "&amp;nbsp". "&lt;/li&gt;"; foreach ($value2 as $key3 =&gt; $value3) { echo "&lt;ul&gt;"; echo "&lt;li&gt;".$key3. ":". "&amp;nbsp". $value3."&lt;/li&gt;"; foreach ($value3 as $key4 =&gt; $value4) { echo "&lt;ul&gt;"; echo "&lt;li&gt;".$key4. ":". "&amp;nbsp". $value4."&lt;/li&gt;"; echo "&lt;/ul&gt;"; } echo "&lt;/ul&gt;"; } echo "&lt;/ul&gt;"; } echo "&lt;/ul&gt;"; } </code></pre> <p>If you would like to know it's concerning Basecamp, I'm trying to get all the relevant project info to be view on screen. If there are any questions or if I was a little bit vague with my question please ask me to clarify, I hope I gave enough information for you guys to see if I'm doing it right. And if not what I'm doing wrong.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload