I'm trying to set some default values in my class but can't use gettext as an variable value
Why does this code give me an error?
class Test
{
private $defaultoptions = array('HideOwnPosts' => false,
'HideClickedLinks' => false,
'AutoCommentLinks' => false,
'AutoCommentText' => gettext('exampletext'),
'AutoOpenCount' => 5);
}
I just need the default value dependend on the users language i use gettext für i18n so i yould like to user ist here too.
You cannot initiate a class member with a 'dynamic' result (gettext()
). Only static values are allowed. If you need to use the result of a function to initialize a member, then you'll have to do it in the constructor, not the class definition.