Answer the question
In order to leave comments, you need to log in
Intercepting an object property call?
Is it possible in php to intercept a property call?
Suppose the data object has a param property, by default it is empty, the first time you access param so that you can execute the def. method for filling it and in the future, if not empty, then do not call the filling method.
Answer the question
In order to leave comments, you need to log in
Accessing a property via a getter/setter.
class Foo {
private $param;
public function getParam() {
//... тут своя логика
return $this->param;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question