Skip to content

Instantly share code, notes, and snippets.

@bjwschaap
Created February 25, 2019 15:15
Show Gist options
  • Save bjwschaap/2dfa175d47fcade4e5090b1dd75b4c5b to your computer and use it in GitHub Desktop.
Save bjwschaap/2dfa175d47fcade4e5090b1dd75b4c5b to your computer and use it in GitHub Desktop.
Example PHP script
<?php
header('Vary: Accept-Language');
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang) {
case "en":
header('Content-Language: en-US');
echo "Hello World!";
break;
case "nl":
header('Content-Language: nl-NL');
echo "Hallo Wereld!";
break;
default:
echo "?????????????";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment