PHP call class method to another class
<p>I've 3 class (Mysqliconn, Users and News).</p>

<p>Mysqliconn.class</p>

<pre><code>Class Mysqliconn {
..connect to db
}
</code></pre>

<p>News.class</p>

<pre><code>class News {
private $db;

   public function __construct( Mysqliconn $db ) {

   $this-&gt;db = $db; 
   }

   public test() {
     do something... 
   }
 }
</code></pre>

<p>Users.class</p>

<pre><code>class Users {
private $db;

   public function __construct( Mysqliconn $db ) {

   $this-&gt;db = $db; 
   }

   public test2() {

     do something...
   }
}
</code></pre>

<p>In my php page </p>

<pre><code> $db = new Mysqliconn();
 $nw = new News( $db );
 $us = new Users( $db )

 $us-&gt;test2();
 $nw-&gt;test();
</code></pre>

<p>My error</p>

<pre><code>Catchable fatal error: Argument 1 
passed to Users::__construct() must be an instance of Mysqliconn, 
none given, called in ....\class\class.news.php 
</code></pre>

<p>Now in my class Users I would like to to call a News class method, 
but I get an error if I try to istantiate the class News inside class Users.</p>

<p>How can I do this?
Thanks.</p>
