我可以在PHP类中使用函数作为变量吗?

Is it possible to create a variable which runs a function and holds its return value when it's called? Like in the example below:

class Object{
     public $var = $this->doSomething();
     function doSomething(){
          return "Something";
     }
}

$object = new Object();
echo $object->$var;

Just because I get this error:

Parse error: syntax error, unexpected T_VARIABLE in test.php on line 2

You must initialize it in the constructor (if the value is not some 'compile-time' constant):

class Object {
     public $var;

     function __construct() {
          $this->var = $this->doSomething();
     }

     function doSomething() {
          return "Something";
     }
}