problems with recursive return values of php
ask the boss to help me look at the recursive loop lookup superiors get all the print data in the loop, but the return returns the data is empty, how is it?
public function for_enter($data=array(),$level=0,$shu=array(),$s=0){
$ui = M("ui");
$array = array();
$where["is_enter"] = 1;
foreach ($data as $k => $v) {
$child = $ui->where(array("code"=>$v["pcode"]))->select();
if (empty($child)) {
return "";
}else{
if ($child[0]["level"] == 4) {
$this->for_enter($child,$level,"");
}else{
if ($child[0]["is_enter"] == 1) {
if (($level - $child[0]["level"]) == 3) {
$shu["three"] = $child[0];
$this->for_enter($child,$level,$shu);
}
if (($level - $child[0]["level"]) == 2) {
$shu["tow"] = $child[0];
$this->for_enter($child,$level,$shu);
}
if (($level - $child[0]["level"]) == 1) {
//
$shu["one"] = $child[0];
$this->for_enter($child,$level,$shu);
}
}
}
}
$array[] = $shu;
}
return $array;
}
print data