There is nothing like this in PHP. You can, however, simulate this behaviour using the magic method __call():
class YourClass {
public function __call($method, $args){
// do what you want to do everywhere (i.e. call your basicFunction)
return call_user_func_array(array($this, 'base'.ucfirst($method)), $args);
}
private baseSomeFunction() {
// ...
}
}
Usage:
$obj = new YourClass();
$obj->someFunction(); // this calls baseSomeFunction and executes the code
// in the __call() method
Prefixing your "magic" methods with something like base ensures that nobody can call your private functions and limits this access to only the functions that have been prefixed. You should change this prefix to suit your needs.
basicFunctioncalled whenfunction1is called or when the ctor is called or when any function is called. Also, isbasicFunctionpart of the theaclass? Please clarify the question and maybe add a concrete example illustrating what you need this for.