$langs = array('en', 'es', 'fr', 'de'); $activeLangs = array('en', 'fr'); foreach ($langs as $lang) { if (in_array($lang, $activeLangs)) { echo $lang.' is active'; } else { echo $lang.' is inactive'; } }
require_once('path/to/language_class.php'); $lang = new Language; $activeLangs = $lang->getActiveLangs(); foreach ($activeLangs as $lang) { echo $lang; }In this example, we are using the getActiveLangs function from a language class library, which we are requiring at the beginning of our script. The function returns an array of active languages, which we are using to loop through and print each language name. Package library: This function does not belong to any specific package library, as it is a built-in function in PHP. However, it can be used in combination with other libraries or classes for multilingual websites or applications.