How to access function inside PHP OOP
- by Industrial
Hi everyone,
What do I need to do to call $this-two() from inside my function innerOne? Is that possible with PHP OOP?
Here's the error I am recieving:
Fatal error: Using $this when not in object context
Here's how my code looks:
class myClass {
function one(){
function innerOne() {
// Some code
$this->two($var1, $var2);
}
// Some code
innerOne();
}
function two($var1, $var2) {
// Does magic with passed variables
return $var1 . $var2;
}
}
Thanks a lot!