获取完整的URL路径并在特定符号后找到该字符串

I am trying to make a simple multilanguage, based on two buttons and get current lang by dedecting the full url path... The problem that i have with my code bellow is that it doesn't return the string after "=" equal symbol

While it display this http://www.example.com/site/?lang=en in the url, i am getting "Array"

<?php
$string = $_SERVER['REQUEST_URI']; 
$string_parts = explode("=", $string); 
if ($string_parts == "en"){
echo "English";
}

if ($string_parts == "De"){
echo "German";
}
?>

You can use $_GET system array for this.

<?php
  $curLang = 'en'; //define a default language code

  if (isset($_GET['lang']))
  {
    $curLang = strtolower($_GET['lang']);
  }


  if ($curLang == 'de')
  {
    echo 'German';
  }
  else if ($curLang == 'fr')
  {
    echo 'French';
  }
  //... this part can be extended or converted to 'switch-case' block on demand
  else
  {
    echo 'English';
  }
?>

I think you are making it more complicated than it is: $_GET contains all the GET-parameters passed in your url. Try

var_dump($_GET);

to see its contents or use

foreach ($_GET as $k=>$v)
   echo $k.' : '.$v

to iterate over its content and display the key names ($k) and the value names ($v) of that array.