Reputation: 4166
Is there a way to access class static property using variable value, like below:
class test
{
private static $test_var = 4444;
public function get_data()
{
$variable_name = 'test_var';
return self::{$variable_name}; //returns:4444,
}
}
thx,
Upvotes: 2
Views: 44