I am new to programming PHP and I need help with what is i'm sure a simple question. I am trying to add values to an array called errors in my form page that way I can echo it out later for verification, although I cant seem to add anything to the array from my included functions file.
I require functions <?php require_once("functions.php") ?>
Then I create the array <?php $errors = array(); ?>
Then I call the function from includes <?php minLength($test, 20); ?>
function here
function minLength($input, $min) {
    if (strlen($input) <= $min) {
        return $errors[] = "Is that your real name? No its not.";
    } else {
        return $errors[] = ""; 
    }
}
then echo them out at and like this at the end
<?php 
        if (isset($errors)) {
            foreach($errors as $error) {
    echo "<li>{$error}</li><br />";
        } 
        } else {
            echo "<p>No errors found </p>";
        }
        ?>
But nothing echos in the end, Thank you in advance for any help
 
     
    