I'm trying to use myVar inside my of a method's function. I have already tried adding global but still nothing. I know this is probably basic but I can't seem to find it.
class myClass{
  
  public $myVar;
  public function myFunction() {
  
    function myInnerFunction() {
      //how do I use this variable here
      echo $this->myVar; 
    }
  }
}
Whenever I try using $this I get this error: 'Using $this when not in object context in...'
 
     
     
     
     
     
     
    