How can I access function b from within function a?
This is what I have so far, and I'm getting this error: PHP Fatal error: Call to undefined method a::b()
class test {
function a($x) {
switch($x)
{
case 'a'://Do something unrelated to class test2
break;
case 'b':
$this->b();
break;
}
}
}
class test2 extends test {
function b() {
echo 'This is what I need to access';
}
}
$example=new test();
$example2=new test2();
$example->a(b);
For background information - function a is a switch for requests sent via AJAX. Depending on the request, it calls a function to add a record to a database, edit it etc.
Thanks!