title: Inheritance of static members in PHP
body: <p>In PHP, if a static attribute is defined in the parent class, it cannot be overridden in a child class. But I'm wondering if there's any way around this. </p>
  
  <p>I'm trying to write a wrapper for someone else's (somewhat clunky) function. The function in question can be applied to lots of different data types but requires different flags and options for each. But 99% of the time, a default for each type would suffice.</p>
  
  <p>It would be nice if this could be done with inheritance, without having to write new functions each time. For example:</p>
  
  <pre><code>class Foo {
      public static $default = 'DEFAULT';
  
      public static function doSomething ($param = FALSE ) {
          $param = ($param === FALSE) ? self::$default : $param;
          return $param;
      }
  }
  
  class Bar extends Foo {
      public static $default = 'NEW DEFAULT FOR CHILD CLASS';
  }
  
  echo Foo::doSomething() . "\n"; 
  // echoes 'DEFAULT'
  
  echo Bar::doSomething() . "\n"; 
  // echoes 'DEFAULT' not 'NEW DEFAULT FOR CHILD CLASS' 
  // because it references $default in the parent class :(
  </code></pre>