Determine what is the level of chlid php
问题 I am trying to get parent child relation and successfully get that But I am stuck how to identify what is the level of the child. Here is my code public function getDownline($userid = null) { $category_data = array(); $where = array('parent_id' => $userid); $this->db->where($where); $category_query = $this->db->get('users')->result(); $category_data = array(); foreach ($category_query as $category) { $category_data[$category->id] = array($category); $children = $this->getDownline($category-