title: php - automatically create an instance of myClass
body: <p>I have a class called myClass in  /myDir/myClass.php.  When user types url:</p>
  
  <pre><code>http://mysite.com/myDir/myClass.php,  
  </code></pre>
  
  <p>I want to automatically create an instance of myClass. What technique can I use to do this? the idea is to use myDir directory as top level of programs that user can call directly, but I don't want to add <code>instance_of_myClass = new myClass();</code> because then I won't be able to extend the class.  Does this make sense?</p>
  
  <pre><code>class myClass
  {    
    __construct()
    {
       echo "hello World";
       $this-&gt;myClass_report();
    }
    myClass_report()
    {
        // some code here
    }
  
  
  }   
  </code></pre>