title: static property sharing/defining between children in PHP classes
body: <p>I'm facing a misunderstanding about what the title describe and i'd like to know if there is another way to achieve what I'm looking for there.
  I have an abstract class which declare a static property without value, and I instanciate subclasses from it that are defining the value of that static property. The base class also define another static property value depending of the first one, but the problem is subclasses are losing their first property value for the last one defined in other subclasses and then this second property get the bad value from the parent class.</p>
  
  <p>This code demonstrate it better than I explain:</p>
  
  <pre><code>abstract class A
  {
      protected static $name; 
      protected static $path;
  
      public function __construct()
      {
          static::$path = static::$name."Path";
      }
  
      public function getPath()
      {
          return static::$path;   
      }
  }
  
  class B extends A
  {
      protected static $name = "B";   
  }
  
  class C extends A
  {
      protected static $name = "C";   
  }
  
  $b = new B();
  $c = new C();
  
  echo $b-&gt;getPath();
  </code></pre>
  
  <p>I expected the echo to print "Bpath", but unfortunately it prints "CPath". 
  If I comment the line that instanciate the C class, then the print is good.</p>
  
  <p><strong>EDIT:</strong>
  The thing is if i do this code :</p>
  
  <pre><code>abstract class A
  {   
      protected static $name;
      protected static $path;
  
      public function __construct()
      {
          static::$path = static::$name."Path";
      }
  
      public function getPath()
      {
          return static::$path;   
      }
  
      public function getName()
      {
          return static::$name;   
      }
  }
  
  class B extends A
  {
      protected static $name = "B";   
  }
  
  class C extends A
  {
      protected static $name = "C";   
  }
  
  $b = new B();
  $c = new C();
  
  echo $b-&gt;getName();
  </code></pre>
  
  <p>The name printed is "B" and good. So the fact of redefining value in subclass property doesn't have the same consequence of doing it in constructor, even if using static:: keyword.</p>