Note that there are some explanatory texts on larger screens.

plurals
  1. POphp Iterator - how to save all second to last elements
    primarykey
    data
    text
    <p>I am at a loss. I've googled, searched on here, read the php manual for hours but I cant come up with a solution.</p> <p>I got the following array structure:</p> <pre><code>[x] =&gt; Array ( ... [object_name_1] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_4] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_n] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [y] =&gt; Array ( ... [object_group_xyz] =&gt; Array ( [object_name_a] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... ) ... [object_name_e] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_z] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) </code></pre> <p>Now my problem is the following: I want to save all object_name_x Arrays. The array is of unknown depth, as a matter of fact, the depth of the various object_name_n objects can depend in the same array. But they are always the last leaf.</p> <p>How can I solve this problem. As far as I've found out, there is no way for RecursiveIteratorIterator to only consider the second to last objects.</p> <p>My output should look like this:</p> <pre><code>Array ( [object_name_1] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_4] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_n] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_a] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_e] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... [object_name_z] =&gt; Array ( [db] =&gt; x [form] =&gt; y [value] =&gt; z ) ... ) </code></pre> <p>Thanks for your time and help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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