title: PHP: Calling a private method from within a class dying badly
body: <p>So this might sound a little convoluted.  Fingers crossed I come across clearly.</p>
  
  <p>I'm working in an MVC framework in PHP. </p>
  
  <p>I load a controller /report/index which calls to a helper </p>
  
  <pre><code>&lt;? class ReportController extends Controller { 
          public function index() {
              $foo = MainReport::get_data($_REQUEST);
          }
  
     }
   ?&gt;
  </code></pre>
  
  <p>Inside the helper</p>
  
  <pre><code>&lt;? class MainReport extends foo {
          public function get_data($_REQUEST) {
              // do stuff
              return $stuff_done;
          }
  
   }
  ?&gt;
  </code></pre>
  
  <p>It I run it like ^this all's well and good.  Unfortunately, I want to run it like this:</p>
  
  <pre><code>&lt;? class MainReport extends foo {
          private function do_stuff() { 
              // do even better stuff here!
              return $better_stuff;
          }
          public function get_data($_REQUEST) {
              // do stuff
              $x = $this-&gt;do_stuff();    
          }
  
   }
  ?&gt;
  </code></pre>
  
  <p>Unfortunately... when I try and call a private function from within a class that I've called from elsewhere... (whew, that's a mouthful) ... everything dies.  Dies so very very badly that I don't even get an error.</p>
  
  <p>It seems obvious to me that I'm having an incredibly dorky sort of syntax issue of some sort... but how do I correctly access private functions from within a class?</p>
  
  <p>Maybe something like: 
      self::do_stuff();</p>
  
  <p>What about declaring and accessing private class variables?</p>
  
  <pre><code> private $bar = array();
  </code></pre>
  
  <p>Any help would be welcome.  </p>