Got an error today that I thought was interesting. Must be a way to do this, perhaps I just have the wrong syntax.
class test{
private $test = '';
__construct(){
$this->test = "whatever";
}
function getTest($var = $this->test){
echo $var;
}
}
This throws an error basically saying that $this->test as a function argument default value is not allowed. unexpected T_VARIABLE.
Now I know for a function not inside of a class, it would be impossible to grab a default value that is another string, but it seems like there should be a way to do this within a class.
Any thoughts?