title: Static member in PHP?
body: <p>I have an example as below:</p>
  
  <pre><code>class Application{
  
      private static $_app;
      public static function setApplication($app)
      {
          self::$_app = $app;
      }
      public static function getApplication()
      {
          var_dump(self::$_app);
      }
      public static function createDemoApplication($config)
      {
          return self::createApplication("Demo",$config);
      }
      public static function createApplication($class,$config)
      {
          return new $class($config);
      }
  }
  
  class Demo{
  
      public function __construct($config)
      {
          Application::setApplication($this);
          Application::getApplication();
          if(is_array($config))
          {
              foreach($config as $key=&gt;$value)
              {
                  $this-&gt;$key=$value;
              }
  
          }
          Application::getApplication();
      }
  
      public function getValue($key)
      {
          return $this-&gt;$key;
      }
  }
  
  $config = array('var1' =&gt; "test 1","var2" =&gt; "test 2");
  echo Application::createDemoApplication($config)-&gt;getValue("var1");
  </code></pre>
  
  <hr>
  
  <p>As the result:</p>
  
  <p>When the code <code>Application::getApplication();</code> is performed in the first place, it returns null. However, this one in the second place return <code>["var1"]=&gt; string(6) "test 1" ["var2"]=&gt; string(6) "test 2"</code></p>
  
  <p>I quite dont understand what happened because I assigned <code>$this</code> to the <code>$_app</code> variable first and then I set <code>$this</code> with new set of key/value.</p>
  
  <p>Could you explain to me about this matter. Thank you</p>