12

I got 2x public functions in a class that must call 1 private function with different parameters also in the same class... for some reason it tell me that it can't find the function...

example:

class Foo {    

private function Do(...)     
{
       ....
       return $whatever;
}

public function One(...)    
{
  return Do(...);
}

public function Two(...)    
{ 
       return Do(...);
} 

}

am getting error:

Fatal error: Call to undefined function do() in ...

0

1 Answer 1

34

You have to use $this to refer to the instance and the T_OBJECT_OPERATOR to access/mutate/call members/methods of an instance, e.g.

$this->do();

Please go through the

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.