php ClassName::staticFunction()->publicFunction() What is this doing?
<p>I'm reading up on php design patterns, and I saw this code:</p>

<pre><code>&lt;?php
require_once("DB.php");

class DatabaseConnection
{
  public static function get()
  {
    static $db = null;
    if ( $db == null )
      $db = new DatabaseConnection();
    return $db;
  }

  private $_handle = null;

  private function __construct()
  {
    $dsn = 'mysql://root:password@localhost/photos';
    $this-&gt;_handle =&amp; DB::Connect( $dsn, array() );
  }

  public function handle()
  {
    return $this-&gt;_handle;
  }
}

print( "Handle = ".DatabaseConnection::get()-&gt;handle()."\n" );
print( "Handle = ".DatabaseConnection::get()-&gt;handle()."\n" );
?&gt;
</code></pre>

<p>I understand it all except the last two print statements. I've been messing around with it, but I don't understand the static function somehow calling a public non-static function. </p>

<p>I've notice I can do:</p>

<pre><code>DatabaseConnection::get()-&gt;get()-&gt;get()-&gt;handle();
</code></pre>

<p>but I can't so something like:</p>

<pre><code>DatabaseConnection::get()-&gt;handle()-&gt;get();
</code></pre>

<p>I just don't understand what this is doing, other than calling the get function then calling the handle function. </p>
