title: How php includes work with objects
body: <p>Let's say that we have a file named "include.php" in a directory, "includes", and this file includes another file, "manager.php", from a sub directory, "objects", </p>
  
  <pre><code>include "objects/manager.php";
  </code></pre>
  
  <p>now "manager.php" is a class names "manager" that has a function that does an include:</p>
  
  <pre><code>public function includeDBObject()
  {
      include "databaseobjects/mysql.php";
  } 
  </code></pre>
  
  <p>This include is another class, "mysql class", that has the following contents:</p>
  
  <pre><code>public $name = "I am in the MySql class";
  
  public function getName()
  {
      return $this-&gt;name;
  }
  </code></pre>
  
  <p>Now back to the original include, "include.php", the contents are as follows</p>
  
  <pre><code>include "objects/manager.php";//as shown above
  
  $a = new manager;
  $a-&gt;includeDBObject();
  $b = new mysql;
  echo $b-&gt;getName();
  </code></pre>
  
  <p>The result of this is: "I am in the MySql class."</p>
  
  <p>Shouldn't the $a->includeDBObject trigger an error of not being able to find the file as the specified directory is incorrect with relation to where "include.php" is located?</p>
  
  <p>According to the php documentation the include does: 
  "The include statement includes and evaluates the specified file."</p>
  
  <p><a href="http://php.net/manual/en/function.include.php" rel="nofollow">http://php.net/manual/en/function.include.php</a></p>
  
  <p>so since manager.php is included the directory in its include function should throw an error as it is "included" in a different directory.</p>
  
  <p>Any explanation would help with references to documentation.</p>
  
  <p>Thanks</p>