title: PHP How to access this array GLOBALLY?
body: <p>I'm not so advanced with PHP and am looking for the best solution to the following:</p>
  
  <ul>
  <li>I have a PHP array that holds important information about my script that </li>
  </ul>
  
  <p>I need to RE-USE this frequently in my script.</p>
  
  <pre><code>$my_settings = array('width'=&gt;'300', 'height'=&gt;'200', ...);
  </code></pre>
  
  <ul>
  <li><p>I store that in a MySQL db.</p></li>
  <li><p>The PHP script needs to get that array from MySQL once each time it runs in order to know how to compose the view.</p></li>
  </ul>
  
  <p>(The array will eventually become quite large... Maybe few hundred rows...)</p>
  
  <p>What is the best practice to get and define this array only ONCE in the beginning of my script, so I can re-use it all the time by other functions etc...? </p>
  
  <p>Is it by defining it globally?</p>
  
  <pre><code>global $my_settings;
  $my_settings = get_my_settings_from_db();
  
  function returnSetting($key='') {
   global $my_settings;
   return $my_settings[$key];
  
  }
  </code></pre>
  
  <p>Or is this bad idea?</p>
  
  <p>What is the most efficient way to do it?</p>
  
  <p>Thanks!</p>