PHP: public static array with multiple keys -


at moment define public static variable below:

public static $closed = array(     'nl' => 'gesloten',     'fr' => 'fermer',     'en' => 'closed', ); 

is there way put array formatted below in public static without nesting?

$days['nl']['mon'] = 'monday'; $days['fr']['tue'] = 'tuesday'; $days['en']['wed'] = 'wednesday'; 

there many ways build arrays (like have done) information have presented above there isn't better or more compact way.

from see, looks doing translations, highly recommend using gettext that. arrays add translations, arrays larger , larger , take more memory.

a basic example of how gettext works following:

echo __('monday'); 

anything passed __() function gets sent through gettext. earlier on in script tell gettext locale want use. end having locale files (.mo) easier handle.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -