This question already has an answer here:
Here i have a private variable called vars which is used to store all the variables inside a class.I am using get_class_vars(__CLASS__)
to get all the variables.But it gives a parse error.
Parse error: syntax error, unexpected '(', expecting ',' or ';' in C:\xampp\htdocs\practice\bal.php on line 5
if i removed the get_class_vars(__CLASS__)
the code works.What might be causing the problem??
class lol{
static private $message='i am shimantta !! ';
private $msg='new';
private $vars=get_class_vars( __CLASS__ );
public function __get($var){
echo $this->$var;
}
}
$lol1=new lol();
$lol1->vars;
</div>