title: Using static properties in PHP >= 4.3.0?
body: <blockquote>
    <p>Disclaimer: Yes, I am forced to
    support PHP 4.3.0. I know it's dead. No I can't upgrade it, because I'm dealing with multiple servers some of which I don't have su access.</p>
  </blockquote>
  
  <p>Well, since I can't use <code>self::</code> since it's PHP5 specific, how should I go about implementing statics in a PHP4 class? So far from my research it seems that I can at least use the <code>static</code> keyword except only in a function context, I've seen another method that uses $_GLOBALS but I don't think I'll be using that.</p>
  
  <p>Just so we're on the same page I need to access these PHP5 statics in 4:</p>
  
  <pre><code>public static $_monthTable = array(
       31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  public static $_yearTable = array(
       1970 =&gt; 0,            1960 =&gt; -315619200);
  </code></pre>
  
  <p>So far, I've come up with my own function that basically sets a static variable if one isn't found, and I hardcode all my static properties into it. However, I'm not entirely sure how I can reference those statics within anther method in the same class, assuming it isn't being instantiated and no constructor is fired, meaning I can't use <code>$this</code>.</p>
  
  <pre><code>class DateClass {
  
      function statics( $name = null ) {
  
          static $statics = array();
  
          if ( count( $statics ) == 0 ) {
              $statics['months'] = array(
                  'Jan', 'Feb'
              );
          }
  
          if ( $name != null &amp;&amp; array_key_exists($name, $statics ) ) {
              return $statics[$name];
          }
      }
  
  };
  
  var_dump( DateClass::statics('months') );
  </code></pre>
  
  <p><strong>Question #1:</strong> Is this feasible? Should I try using a different method?</p>
  
  <p><strong>Question #2:</strong> How would I reference the statics from a method in the same class? I tried <code>__CLASS__::statics</code> but I think <code>__CLASS__</code> is just a string so I'm not really invoking a method.</p>
  
  <p><strong>Note:</strong> I'll be implementing this into a framework which will be used on Apache2+/IIS6+, PHP4.3.0 to PHP 5.2, OSX/Linux/Windows.</p>