title: Replicating Codeigniters load function
body: <p>I have recently been playing around with Codeigniter to see what I can learn from it. I came across the load function and was wondering if anyone knows how its done. Basically, it looks something like:</p>
  
  <pre><code>$this-&gt;load-&gt;model('Model_name');
  $this-&gt;Model_name-&gt;some_function();
  </code></pre>
  
  <p>Now load is obviously a class and an instance is created and called load. And load includes the class "Model_name" and creates an instance of it. But the part I cant work out, is how does the load class create a "class variable" named "Model_name" to be used as in the second line of the code? And how would I actually go about implementing this in php.</p>
  
  <p>Thanks.</p>