can anybody tell me what is the wrong with this function?
I wrote this this function to get errors from $reg_errors array and to use those errors in different place in the same script.
function testimonialErrors ($reg_errors) {
    if ( !empty($reg_errors) ) {
            foreach ( $reg_errors AS $error) {
                echo "<li>$error</li>";
            }                                       
    }
    return $error; 
}
Then I called that function like this..
if ( !empty($reg_errors) ) {
    echo '<div class="error">
                <img src="images/error.png" />
                <h3>Errors,</h3>
                <ul>';
                echo testimonialErrors($reg_errors);
        echo '</ul>
            </div>';
}
But this code is not working.
UPDATE : this is my new code
function tesimonialErrors ($reg_errors) {
    if ( !empty($reg_errors) ) {
            foreach ( $reg_errors AS $error) {
                echo "<li>$error</li>";
            }                                       
    }
    return $error; 
}
And called it like this
if ( !empty($reg_errors) ) {
    echo '<div class="error">
                <img src="images/error.png" />
                <h3>Errors,</h3>
                <ul>';
                tesimonialErrors($reg_errors);
        echo '</ul>
            </div>';
}
 
     
     
     
     
     
    