PHP recursion: How to create a recursion in php -
i have little problem recursion in php. have read many articles solution doesn't come.
i have array:
[59] => array ( [id] => rel000000 [name] => religione / generale [description] => [idparent] => ) [799] => array ( [id] => rel102000 [name] => religione / teologia [description] => [idparent] => rel000000 ) [800] => array ( [id] => rel068000 [name] => religione / teosofia [description] => [idparent] => rel000000 ) [801] => array ( [id] => rel103000 [name] => religione / universalismo unitario [description] => [idparent] => rel000000 ) [802] => array ( [id] => rel034000 [name] => religione / festività / generale [description] => [idparent] => rel000000 )
i create hierarchical tree idparent field match id field.
does me?
thanks
use &
operator:
$array[$id_child]['parent'] = &$array[$id_parent];
and also:
$array[$id_parent]['children'][] = &$array[$id_child];
Comments
Post a Comment