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