Answer the question
In order to leave comments, you need to log in
How to check for the presence of directories and remove the missing ones from the array?
Hello, the structure is as follows:
/index.php - among other things, controls the redirect to the desired localization
/langs.php - contains an array with all languages
<?PHP
return array(
array(
'name' => 'Russia',
'sysname' => 'ru',
),
array(
'name' => 'Germany',
'sysname' => 'de',
),
array(
'name' => 'European-union',
'sysname' => 'en',
),
array(
'name' => 'Australia',
'sysname' => 'au',
),
);
Answer the question
In order to leave comments, you need to log in
foreach ($langs as $key => $value) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/lib/langs/'. $value['sysname'] .'/index.php')) {
}else{
unset($langs[$key]);
};
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question