Skip to content

Instantly share code, notes, and snippets.

@mamchenkov
Created April 23, 2014 12:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamchenkov/11212642 to your computer and use it in GitHub Desktop.
Save mamchenkov/11212642 to your computer and use it in GitHub Desktop.
<?php
// Keep bumping up in powers of two
define('LANG_LIST_VISIBLE', 1);
define('LANG_LIST_HIDDEN', 2);
define('LANG_LIST_BOTH', 4);
print "\nBoth\n";
print_r(getSupportLanguages(LANG_LIST_BOTH));
print "\nVisible\n";
print_r(getSupportLanguages(LANG_LIST_VISIBLE));
print "\nHidden\n";
print_r(getSupportLanguages(LANG_LIST_HIDDEN));
function getSupportLanguages($params) {
$result = array();
$visible = array(
'en', 'ru',
);
$hidden = array(
'sk', 'nb',
);
if ($params & (LANG_LIST_VISIBLE | LANG_LIST_BOTH)) {
$result = array_merge($result, $visible);
}
if ($params & (LANG_LIST_HIDDEN | LANG_LIST_BOTH)) {
$result = array_merge($result, $hidden);
}
return $result;
}
?>
@flangofas
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment