我想使用php函数或php类将第一个数组的输出输出到第二个数组-
我应该在这里加上-
- “ deli”键的值“ |”是“名称”键值的分隔符。
- 如果数组中“ attr”键的值为“ 32”,则该数组有子级,并在“ title”中添加子级。
$Y=array(array('name' => "Family1",'attr' => array(64,8),'deli' => "|"),array('name' => "Family2",'attr' => array(32,8),'deli' => "|"),array('name' => "Family2|Parents1",'attr' => array(64,8),'deli' => "|"),array('name' => "Family2|Parents3",'attr' => array(32,8),'deli' => "|"),array('name' => "Family2|Parents3|Children",'attr' => array(32,8),'deli' => "|"),array('name' => "Family2|Parents3|Children|ChildOfChild",'attr' => array(64,8),'deli' => "|"),array('name' => "Family4",'attr' => array(32,8),'deli' => "|"),array('name' => "Family4|Child",'attr' => array(64,8),'deli' => "|"));
$Y2=array(array('name' => "Family1",'title' => "Family1",'attr' => array(64,8),'deli' => "|"),array('name' => "Family2",'title' => "Family2",'attr' => array(32,8),'deli' => "|",'child' => array('name' => "Family2|Parents1",'title' => "Parents1",'attr' => array(64,8),'deli' => "|"),array('name' => "Family2|Parents3",'title' => "Parents3",'attr' => array(32,8),'deli' => "|",'child' => array('name' => "Family2|Parents3|Children",'title' => "Children",'attr' => array(32,8),'deli' => "|",'child' => array('name' => "Family2|Parents3|Children|ChildOfChild",'title' => "ChildOfChild",'attr' => array(64,8),'deli' => "|")))),array('name' => "Family3",'title' => "Family3",'attr' => array(64,8),'deli' => "|"),array('name' => "Family4",'title' => "Family4",'attr' => array(32,8),'deli' => "|",'child' => array('name' => "Family4|Child",'title' => "Child",'attr' => array(64,8),'deli' => "|")));