Compare $_GET variable to array in php
<p>I am getting a variable from the url in php using $_GET[]. The url looks like: <a href="http://www.site.com/index.php?x=B%FCergschaften" rel="nofollow">http://www.site.com/index.php?x=B%FCergschaften</a> which i am comparing to values in an array: <code>$y=array('Bauherrenhaftpflicht','Gebäudeversicherung','Büergschaften');</code></p>

<p>I understand that the variable in the url is decoded by the $_GET function but when i compare it to the array i am not getting a match.</p>

<p>This is the code i use to compare:</p>

<pre><code>$x = $_GET['x']; foreach($y as $value){ if($value == $x){ echo "Found!"; } }
</code></pre>

<p>I have tried <a href="http://php.net/manual/en/function.urldecode.php#refsect1-function.urldecode-notes" rel="nofollow">urldecode function</a> but it doesn't work.</p>

<p>How do I correctly decode the variable from the url so that the special character is correctly decoded and the variable compared to the array? </p>

<p>Many thanks.</p>
