Passing a reference to a class
<p>I have a $database object that I need to reference inside another class.<br>
Would this be the right way to do that?</p>

<pre><code>&lt;?php
class User {
  private $database;

  function getPosts($limit = 1) {
    return $this-&gt;database-&gt;query("select...");
  }

  function __construct(&amp;$database) {
    $this-&gt;database = $database; // Do I need an another ampersand here?
  }
}

$user = new User($database); // $database is defined in an earlier include
?&gt;
</code></pre>
