PHP: Calling a private method from within a class dying badly

dataviruset

New Member
So this might sound a little convoluted. Fingers crossed I come across clearly.I'm working in an MVC framework in PHP. I load a controller /report/index which calls to a helper \[code\]<? class ReportController extends Controller { public function index() { $foo = MainReport::get_data($_REQUEST); } } ?>\[/code\]Inside the helper\[code\]<? class MainReport extends foo { public function get_data($_REQUEST) { // do stuff return $stuff_done; } }?>\[/code\]It I run it like ^this all's well and good. Unfortunately, I want to run it like this:\[code\]<? 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->do_stuff(); } }?>\[/code\]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.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?Maybe something like: self::do_stuff();What about declaring and accessing private class variables?\[code\] private $bar = array();\[/code\]Any help would be welcome.
 
Back
Top