What are some alternative methods for implementing a language switch feature in PHP to ensure the same page is displayed in the selected language?

When implementing a language switch feature in PHP, one alternative method is to use session variables to store the selected language and dynamically load the appropriate language file based on the user's selection. This ensures that the same page is displayed in the selected language without the need to redirect to a different page.

```php
<?php
session_start();

// Default language
$language = 'english';

// Check if language is set in session
if(isset($_SESSION['language'])) {
    $language = $_SESSION['language'];
}

// Include language file based on selected language
include 'languages/'.$language.'.php';

// Example usage of language strings
echo $lang['welcome_message'];
```

In this code snippet, we first start the session and set a default language. We then check if the language is already set in the session, and if so, we use that language. We include the language file based on the selected language, and then we can use the language strings from the included file to display content in the selected language.