title: PHP Static Array Workaround
body: <p>I have an array structure with key and value pairs that are multiple dimensions deep.  I want to use this array in a class, but I don't want it added to each instance, since it is simply a reference needed by that class.</p>
  
  <p>This is the workaround I have come up with through Google and Stack Overflow searching.  It works for what I need, but are there any obvious issues more experienced PHP programmers can see with it?</p>
  
  <pre><code>class Foo {
  
      public static function bar($key = null) {
  
          $array = array('key'=&gt;array(1,2,3));
  
          if ($key &amp;&amp; array_key_exists($key, $array)) {
              return $array[$key];
          } else {
              return $array;
          }
      }
  }
  </code></pre>