Q:

Remove array if empty

I have an array of errors for file upload.
It display errors message if the upload went wrong.
But if the array is getting no errors, it display "Array" on my view.
How to remove the "Array" if it's empty?
My controller:
if (!is_null($avatar) && !empty($avatar)) {
            if ($_FILES && $_FILES['avatar']['name'] !== "") {
                if (!$this->upload->do_upload('avatar')) {
                    $data['errors'] = array('error' => $this->upload->display_errors());
                } else {
                    $image = $this->upload->data();
                    $avatar = $image['file_name'];
                }
            }
        }
$this->load->view('auth/edit_profile_form', $data);

My view:
<div class="errors">
<?php echo $errors; ?>
</div>

A:

Check the amount of entries on your errors array:
echo (count($errors) > 0 ? implode("<br>", $errors) : '');

