欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

循环递归-数组,循环递归数组_PHP教程

程序员文章站 2022-05-11 15:17:33
...

循环递归-数组,循环递归数组

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;
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/927468.htmlTechArticle循环递归-数组,循环递归数组 private function Fndotoarea($oid){ $oid = $this-CHTID($oid); $arrtaff = array(); $arrt =array(); $arrr = array(); foreach($this-select("SEL...
相关标签: 递归函数