0

i am having problems accessing the 'nodes' item

this is a piece from print_r from my array

in the last line of this post print_r($item['nodes']);// <-- this does not works

How does it come, i must have been doing something wrong but cant figure it out

thx in advance Bert

Array
(
[id] => 1
[name] => Drinken
[view-url] => Array
(
[0] => pu/default/view
[id] => 1
)
[update-url] => Array
(
[0] => pu/default/update
[id] => 1
)
[create-url] => Array
(
[0] => pu/default/create
[id] => 1
)
[delete-url] => Array
(
[0] => pu/default/delete
[id] => 1
)
[nodes] => Array
(
[0] => Array
(
[id] => 1^1
[name] => Cola
[view-url] => Array
(
[0] => group/default/view
[id] => 1
)

[update-url] => Array
(
[0] => group/default/update
[id] => 1
)
[create-url] => Array
(
[0] => group/default/create
[id] => 1
)
[delete-url] => Array
(
[0] => group/default/delete
[id] => 1
)
)

foreach ($items as $item) {
echo "<div id='trvid_" . $item['id'] . "' class='trvwcatname'>" . $item['name'] . "</div>";
echo '<pre>';
print_r($item);
echo '</pre>';
echo '<hr>';
print_r($item['id']);// <-- this works
echo '<hr>';
print_r($item['view-url']);// <-- this works
echo '<hr>';
print_r($item['nodes']);// <-- this doesnt works
}
  • You're running this inside of a loop. Do *all* of the arrays you're looping over contain `nodes`? – Obsidian Age Jan 29 '18 at 21:52
  • thx, obsidian age --> i forgot my counter(in one place) in the loop where i build my array. $tmppuarray['nodes'][$itemcounter] = $tmpitemarray; thx for pointing me in the right direction. – user3242509 Jan 29 '18 at 22:50

0 Answers0