title: PHP - OOP class extend
body: <p>Been searching all around but still cannot find a solution for this problem.
  My problem is that i got these snips of code(Examples):</p>
  
  <p><strong>Core file</strong></p>
  
  <pre><code>class Core {
      public $DB = null;
      public $Handler = null;
  
      function run() {
          $this-&gt;DB = "somedatabase";
  
          include_once('handler.php');
          $this-&gt;Handler = new Handler;
  
          $this-&gt;Handler-&gt;run();
      }
  }
  </code></pre>
  
  <p>This is the helper.php example</p>
  
  <pre><code>class Handler extends Core {
      function run() {
          echo "&lt;pre&gt;"; print_r($this); echo "&lt;/pre&gt;"; die();
      }
  }
  </code></pre>
  
  <p>Even tho i defined the DB variable before i include the helper then it is still empty inside the helper class. It's defined yes but it's empty. Which means it properly doesn't share the same memory as the Core class.</p>
  
  <p>Keep in mind that the Core class it self is instanced too.</p>
  
  <p>-</p>
  
  <p>Thanks for all suggestions</p>
  
  <p><strong>Edit</strong></p>
  
  <p>PhpMyCoder got it right. Thank you for the detailed and well written reply.
  For over 2 years i been seeing PHP scopes as being the same or sorta the same as JavaScript's scope. Now i realize that if i extend my "Core" class i get all the methods and properties within it. But the values is private to my class and my class alone.</p>
  
  <p>This is great. Finally i got it. </p>