php function variable scope
<p>I was wondering if i have a function like this:</p>

<pre><code>function isAdmin ($user_id) {

    $admin_arr = array(1, 2);

    foreach ($admin_arr as $value) {

        if ($value == $user_id) {
            return true;
        }
    }

    return false;
}
</code></pre>

<p>Could i make an array outside of that function as a global array and use it inside the function without sending it through as a parameter, also instead declaring a new admin array inside the function as i just did above? How would i do this? </p>

<p>Regards,
Alexander</p>
