lundi 21 juin 2021

How can I use php loop inside if else statement

if (isset($_GET['language']) && !empty($_GET['language'] && $_SESSION['language'] !== $_GET['language'])) {
    if ($_GET['language'] === 'en') {
      $_SESSION['language'] = 'en';
    } elseif ($_GET['language'] === 'ar') {
      $_SESSION['language'] = 'ar';
    } elseif ($_GET['language'] === 'de') {
      $_SESSION['language'] = 'de';
    } else {
      $_SESSION['language'] = $default_language;
    }
  }

I would like to loop only elseif statements. Is there away to achieve this?

Aucun commentaire:

Enregistrer un commentaire