title: How to loop over the static data members of a class - using a variable for the class name?
body: <p>In PHP, if I have a class with static member variables, such as:</p>
  
  <pre><code>class Foo
  {
      public static $a = 0;
      public static $b = 1;
  }
  </code></pre>
  
  <p>... and I have a string variable containing the name of the class:</p>
  
  <pre><code>$foo = 'Foo';
  </code></pre>
  
  <p>... how do I loop over the static data members of class <code>Foo</code> using the variable <code>$foo</code>?</p>
  
  <p>Something like:</p>
  
  <pre><code>// Does not work
  foreach ($foo AS $field =&gt; &amp;$value) {
      // Desired:
      // Iteration 1: $field = 'a', $value = 0
      // Iteration 2: $field = 'b', $value = 1
  }
  </code></pre>
  
  <p>As noted, the above code snippet does not work.</p>
  
  <p>Is this possible?  If so, what is the syntax?</p>
  
  <p>Thanks.</p>