Hi I have this PHP array of Amazon Sub Categories what I am trying to do is loop through the array and split into 3 seperate ones,
Heres the Array, and needs to be split into 3 arrays $request, and all the children under it $subCats and final variable $Ancestors. The $subCats will contain all the ChildrenBrowseNode. Its driving me mad I cant seem to loop through correctly.
Any thoughts people. Cheers in advanced.
J.
Array
(
Request => Array
(
IsValid => True
BrowseNodeLookupRequest => Array
(
BrowseNodeId => 66471031
ResponseGroup => Array
(
0 => BrowseNodeInfo
)
)
)
BrowseNode => Array
(
BrowseNodeId => 66471031
Name => Beauty
Children => Array
(
BrowseNode => Array
(
0 => Array
(
BrowseNodeId => 118423031
Name => Cosmetics
)
1 => Array
(
BrowseNodeId => 74006031
Name => Cosmetics_hidden
)
2 => Array
(
BrowseNodeId => 118457031
Name => Fragrances
)
3 => Array
(
BrowseNodeId => 66466031
Name => Fragrances_hidden
)
)
)
Ancestors => Array
(
BrowseNode => Array
(
BrowseNodeId => 66280031
Name => Categories
IsCategoryRoot => 1
Ancestors => Array
(
BrowseNode => Array
(
BrowseNodeId => 65801031
Name => Health & Beauty
)
)
)
)
)
)
,
This should do it:
$request = your_main_array'request';
$subCats = your_main_array'BrowseNode''Children''BrowseNode';
$Ancestors = your_main_array'BrowseNode''Ancestors'
‘Children”BrowseNode’ and ‘Ancestors’ are in a BrowseNode Array under you main array.