PHP: Class vs Instance variables
<p>I know there is a difference in class variables and instance variables in programming languages like Java and C#, so I was wondering if PHP is the same.</p>

<p>So I know class variables is shared among all the instances of that class whereas instance variables is only relevant to that specific instance of that class.</p>

<p>For example:</p>

<pre><code>class db {
  private $host;   &lt;--
  private $user;   &lt;-- These will be treated as instance variables
  private $pass;   &lt;-- as they are set by the class constructor
  private $dbname; &lt;--

  private $connected = false; &lt;-- Will this be treated as a class 
                                  variable? Shared among all the 
                                  instance of the db class?

  public function __construct($host, $user, $pass, $dbname) {
    $this-&gt;host = $host;
    $this-&gt;user = $user;
    $this-&gt;pass = $pass;
    $this-&gt;dbname = $dbname;
  }

  public function checkConn() {
    // some code here to change the value of $this-&gt;connected
  }
</code></pre>