仅从指定的数组值中回显值

Please check following codes and tell me how can i echo $error[] array when each error receives a value when my code conditions meet. or is there any short solution for that? i want to echo error message when conditions meet. whats the best short hand solution for that?

if (isset($_POST['submit_update'])) {
    if (empty($_POST['old_pass']) || empty($_POST['new_pass'])) {
        $error[] = '<div class="alert alert-danger">Error: Field can not be empty</div>';
    }elseif ($user->check_old_admin_pass($_POST['old_pass'])==true) {
        if($user->update_pass($_POST['new_pass'])==true){
            $error[] = '<div class="alert alert-success">Success: New password is set</div>';
        }else{
            $error[] = '<div class="alert alert-danger">Error: Fail to update</div>';
        }
    }else{
        $error[] = '<div class="alert alert-danger">Error: Wrong old password</div>';
    }
}

You could just try something very simple like so:

<?php

    $strError    = '';
    if(isset($error) && !empty($error)){
        $strError .= '<div class="error_wrapper">';
        $strError .= implode("
", $errors);
        $strError .= '</div>';
    }
    echo $strError;