Language switch based on parameters and session state
Yes.  Definitely.  You can use a lookup array.

$langs = [
    'en' =&gt; 'gb',
    'tr' =&gt; 'tr',
];

$defaultLang = 'it';


if (isset($_GET['lang'])) {
    $lang = strtolower($_GET['lang']);
    $_SESSION['lang'] = $langs[$lang] ?? $defaultLang;
} elseif (!isset($_SESSION['lang'])) {  // meaning, no $_GET['lang'] and no $_SESSION['lang']
    $_SESSION['lang'] = $defaultLang;
}
// if there is no $_GET['lang'] and there is a $_SESSION['lang'], then nothing to update


A lookup array is concise and a breeze to maintain.  You only need to update the lookup or the fallback value; never the processing block.

?? is the null coalescing operator, so if the lang value is not found in the lookup, the fallback value will be used.

If your php version is not over 7 (then I urge you to upgrade) then you will need a longer condition syntax.

$_SESSION['lang'] = isset($langs[$lang]) ? $langs[$lang] : $defaultLang;