Basic inheritance will resolve all your issues.
class A{
public $a;
public $b;
public function __construct(){
}
public function x(){
$this->a = "something";
$this->b = "something1";
}
public function abc(){
$printthis = call_user_func(array($obj2,$method_name);
echo $printthis;
}
// to call abd() method from class B inside this class
function call_child_method(){
if(method_exists($this, 'abd')){
$this->abd();
}
}
}
$obj1 = new A;
$obj1->x();
class B extends A{ // object will can call both methods of class A and B
public $a;
public $b;
public function __construct($c,$d){
$this->a = $c;
$this->b = $d;
}
public function abc(){
//some code here that returns something
}
public function abd(){
//some code here that returns something
}
// to call X() method from class A inside this class
parent::X();
}
$obj2 = new B($obj1->a, $obj1->b);