程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> php 將一個二維數組轉換成有父子關系的數組

php 將一個二維數組轉換成有父子關系的數組

日期:2017/1/17 17:52:45      編輯:關於PHP編程

<?
     = 
      __construct(,  = ('id', 'pid'),  = 0->result = ->fields = ->root = ->
      (->result  [[->fields[1]]][] = ( ( = ();  > 0; -- (   =>  (!(, -> (!->->tmp = (, ->already[] =  (   =>  ([->fields[0]] == ->tmp[0[][]['child'] = ->tmp[1->tmp = (, [->tmp = ->tmp = 
      recur_n(,  (   ([->fields[0]] == ->arr[] =  ([->fields[1]] != ->root) ->recur_n(, [->fields[1
      recur_p( (  ->arr[] = [->fields[0 (['child']) ->recur_p(['child'
      leaf( =  = ( == ) ? ->root :  ->tmp[
      navi(->arr = ->recur_n(->result, (-> ->
      leafid(->arr = ->arr[] = ->recur_p(->leaf( ->?>

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved