UPDATE
OTHER CLASS
- OtherClass->functionA
- OtherClass->functionB
- OtherClass->whatever (dynamic) <– Possible to call OtherClass->foo or OtherClass->bar
CLASS A
class A
{
protected $_data;
public function __construct()
{
$other = new OtherClass;
$something = $this->_data;
$this->process = $other->$something; // Not Work
}
public function ipsum()
{
return $this->process;
}
}
CLASS B
class B extends A
{
protected $_data = 'string';
public function __construct()
{
parent::__construct();
}
public function lorem()
{
return $this->ipsum(); // $other->string;
}
}
How can i get $_data?
It working with $other->foo without variable
Help.. Thanks
Are you sure you don’t mean:
$other->$somethingwill return the property whose name is stored in$somethingfrom the object$other, and, from your example above,$somethingisNULL.