码迷,mamicode.com
首页 > 编程语言 > 详细

循环递归-数组

时间:2014-12-15 10:12:54      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:des   io   ar   for   on   cti   as   br   ht   

private function Fndotoarea($oid){
  $oid = $this->CHTID($oid);
  $arrtaff = array();
  $arrt =array();
  $arrr = array();
  foreach($this->select("SELECT areaname , tid FROM otoarea WHERE oid = ‘".$oid."‘ " ) as $ks){
    $arrr= Array("node"=>$ks["areaname"],"value"=>$ks["tid"]);
  foreach ($this->select("select areaname , tid FROM otoarea WHERE oid = ‘".$ks["tid"]."‘ ") as $kr){
    $arrr[‘nodes‘][] = Array("node"=>$kr["areaname"],"value"=>$kr["tid"]);
}
  $nodes = $this->Fndotoarea($ks["tid"]);
  if(!empty($nodes)){
    $arrr["nodes"] = $nodes;
}
  array_push($arrtaff, $arrr);
}
  return $arrtaff;
}

/*-------------------------------------------------------------*/

private function Fndotoarea($oid){
$oid = $this->CHTID($oid);
$arrtaff = array();
$arrt =array();
$arrr = array();
foreach($this->select("SELECT areaname , tid FROM otoarea WHERE oid = ‘".$oid."‘ " ) as $ks){
$arrr= Array("node"=>$ks["areaname"],"value"=>$ks["tid"]);
foreach ($this->select("select areaname , tid FROM otoarea WHERE oid = ‘".$ks["tid"]."‘ ") as $kr){
$arrr[‘nodes‘][] = Array("node"=>$kr["areaname"],"value"=>$kr["tid"]);
}
$nodes = $this->Fndotoarea($ks["tid"]);
if(!empty($nodes)){
$arrr["nodes"] = $nodes;
}
array_push($arrtaff, $arrr);
}
return $arrtaff;
}

循环递归-数组

标签:des   io   ar   for   on   cti   as   br   ht   

原文地址:http://www.cnblogs.com/zc39765547/p/4164167.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!