I have create recursive function for print leveltree

function createTreeView($array, $currentParent, $currLevel = 0, $prevLevel = -1, $ul=array()) {

    foreach ($array as $categoryId => $category) {
         if ($currentParent == $category['parentid']) {                       
            if ($currLevel > $prevLevel) $ul[] = " <ul> "; 
            if ($currLevel == $prevLevel) $ul[] = " </li> ";
            $ul[] = '<li> '.$category['name'].'';
            if ($currLevel > $prevLevel) { $prevLevel = $currLevel; }
        $currLevel++; 

           $this->createTreeView($array, $categoryId, $currLevel, $prevLevel, $ul);
           $currLevel--;               
       }   
    }
       if ($currLevel == $prevLevel) 
        $ul[] = " </li>  </ul> ";       
        return $ul;
    }

I have use this recursive function into following function but they have not return any value

public function getLevelTreeTemplate()
{
    global $themeData;
    global $user, $conn;
    $listTree = '';
    $currentParentStrQry = $conn->query("SELECT * FROM ".DB_CLUB." WHERE user_id='".$user['id']."'");
    $currentParentStrData = $currentParentStrQry->fetch_array(MYSQLI_ASSOC);
    $currentParentStr = $currentParentStrData['ParentStr'];

    $childUserQry = $conn->query("SELECT user_id FROM ".DB_CLUB." WHERE ParentStr LIKE '%".$currentParentStr."%'");
    while($chlidUserData = $childUserQry->fetch_array(MYSQLI_ASSOC)){
        $data[] = implode(",",$chlidUserData);
    }
    $arrayCategories = array();
    $resultQry = $conn->query("SELECT * FROM ".DB_CLUB." WHERE user_id IN(".implode(',',$data).")");
    while($resultData = $resultQry->fetch_array(MYSQLI_ASSOC)){

             $arrayCategories[$resultData['user_id']] = array(
              "parentid" => $resultData['refferance_id'], 
              "name" => $resultData['first_name']
             );
    }
        $themeData['levelTree'] = $this->createTreeView($arrayCategories, $currentParentStrData['refferance_id']);          
        $listTree .= \MassConn\UI::view('timeline/user/list-leveltree');    
    $themeData['list_leveltree'] = $listTree;
    return \MassConn\UI::view('massconnectclub/sidebar-leveltree'); 

}