public static function TreeTitle($data, $tree, $id = 0, $text = '') { foreach ($data as $key) { $show_text = $text . $key->text; if ($key->parent_id == $id) { $tree[$key->value] = $show_text; $tree = Bt_portfolioHelper::TreeTitle($data, $tree, $key->value, $text . " -- "); // » } } return $tree; }