Ver originalfunction sum($id) { $total = 0; if ($row->parent) { $total += sum($row->parent); } $total += $row->value; return $total;}