Answer the question
In order to leave comments, you need to log in
How to convert an array to another form?
There is a tree-like array with a menu of this kind demo.maika-cool.ru in the children cell to contain all its child elements. You need to write a function for it that will convert it to the next array.
/*************** THE ARRAY WHICH REQUIRES A CONVERSION CAN BE VIEWED BY CLICKING THE LINK ABOVE ************** PIECE OF EXAMPLE /
Array
(
[0] => Array
(
[id] => 1
[class] => vm-visible-md vm-visible-lg
[depth] => 1
[title] => Create
[action] => Array
(
[href] => /constructor
[ target] =>
)
[is_new] =>
[children] => Array
(
[0] => Array
(
[id] => 2
[class] => vm-visible-xs vm-visible-sm vm-visible-md vm-visible-lg
[depth] => 2
[title] => Men
[action] => Array
(
[href] => /catalog/view/manwear?sort=sell
[target] =>
)
[is_new] =>
[children] => Array
/************* WHAT I WANT TO SEE IN THE NEW ARRAY OUTPUT ********************/
array(
' id'=>1, //ID menu
'title'=>'value of cell title',
'class'=> 'Value of cell class',
'depth'=> 'Possible nesting level although not needed',
'action ' => 'action cell value further href',
'parent_id' => 5 //parent ID if if yes if not then 0);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question