PHP: return array?
<p>I have index.php, and function.php.</p>

<p>In index.php i have included function.php</p>

<p>In index.php im calling <code>login("Bla","123");</code> which exists in function.php</p>

<p>In index.php I have a <code>if (!empty($err)){ foreach(..) echo $err ... }</code></p>

<p>login() should return a array called $err, (with return $err; ) if there is any errors, and then it should echo it out in the foreach in index.php..</p>

<p>But somehow I can not get it to work. Can't you do it like this? Im not getting anything back.</p>

<p>I have in the login() :</p>

<pre><code>$err = array();
    $err[] = "Something went wrong";
        return $err;
        exit();
</code></pre>

<p>What's wrong here? Or any other solution to do this?</p>
