how to use an array as Global and access it from all other files in PHP : <p>I have a file called users.php where I am adding usernames in array as below</p>

<pre><code>&lt;?php

 $users = array("alexritz","katrob","diaman","janber","denivar","hamrop","calvik");

?&gt;
</code></pre>

<p>everytime I need this array in another php file I use <code>require 'users.php';</code> and do whatever I need with this array. </p>

<p>I want to make my array global and use it across all files without using <code>require</code>. I know how to use session and it works for me but I am chasing the global how to make it work. I tried as below</p>

<blockquote>
  <p>users.php</p>
</blockquote>

<pre><code>&lt;?php

 $users = array("alexritz","katrob","diaman","janber","denivar","hamrop","calvik");

function globalUsers() {
return $GLOBALS['users']; }

globalUsers();

?&gt;
</code></pre>

<p>then in any other php file I just call <code>globalUsers();</code> but it's not working. </p>

<p>Any ideas please ? Thank you.</p>
