I got this problem trying to echo out a big array.
print_r looks like this: http://codepaste.net/5js97a
There's no problem echoing out the first 2 rows like this in a foreach loop: $item['name'], but for the rest of them deeper inside the array, I just get an error.
Thanks!
Code:
function categories($parent = NULL) {
$query = $this->db->where('parent_id', $parent)->get('categories');
$results = $query->result_array();
foreach($results as $result) {
$child_array = Forummodel::categories($result['id']);
if(sizeof($child_array) == 0) {
array_push($results, $result['name']);
} else {
array_push($results, array($result['name'], $child_array));
}
}
return $results;
}
Im also using codeigniter